Error: DexArchiveMergerException: Unable to merge dex

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

environment:
android studio 3.0 build 4408382

solution:

test 1: From the Build menu, press the Clean Project button.
--> result:  failed. not work.


task 2: restart a.s.
Error:Please use JDK 8 or newer.
Use embedded JDK (recommended)
Download JDK 8
Select a JDK from the File System

 test 2: reset- jdk location  and Delete the ./gradle folder inside your project
 --> result: failed. not work.


task3:
add setting in my Android Manifest.


        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
...
 
 
result: 
error:still fail.
error: cannot find symbol class GoogleApiAvailability
 
 
the code still error:
public boolean isGooglePlayServicesAvailable(Activity activity) {
    GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
    int status = googleApiAvailability.isGooglePlayServicesAvailable(activity);
    if(status != ConnectionResult.SUCCESS) {
        if(googleApiAvailability.isUserResolvableError(status)) {
              googleApiAvailability.getErrorDialog(activity, status, 2404).show();
        }
        return false;
    }
    return true;
}
 
 
solution:
remove the function and not use it.
ok.... run successful.  
 
my setting:
dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   compile 'com.android.support:design:+' 
 implementation 'com.google.android.gms:play-services-ads:11.6.0' 
 implementation 'com.android.support:appcompat-v7:27.0.1'}
 
ps: i don't want to use total com.google.android.gms:play-services
because it's so big.
just ads.
 
 
 








留言

這個網誌中的熱門文章

最爛的銀行服務-玉山銀行

Mark App Design Apps - Terms and Privacy Policy (服務條款,隱私權政策)

SMR疊瓦式hdd致命缺陷被解決????!!!

ios app 上架時app icon要注意事項

更改google drive預設存放目錄位置Change Google Drive Default Folder Location in Windows

舊有app在Android 12 閃退問題& app Splash screens

google play 正式發布前測試報告...非常好用.

app bundle and bundletool. 關於aab安裝問題

關於google play console app應用程式簽署

Google Play badge徽章產生器