我做了:
>在“设置” – >“Android SDK” – >“SDK工具”中检查并安装Google Play服务v.46
>删除文件夹/.gradle
>“清洁工程”
>“重建项目”
错误是:
@H_403_9@Error:Execution Failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex这是命令gradlew -q app:dependencies>> app_dependencies.txt的输出
运行命令后
gradle:app:assembleDebug –stacktrace
我明白了:
我的项目gradle文件:
@H_403_9@apply from: 'dependencies.gradle' buildscript { repositories { jcenter() mavenCentral() maven { url "https://jitpack.io" } maven { url 'https://maven.fabric.io/public' } google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.google.gms:google-services:3.1.0' classpath 'io.fabric.tools:gradle:1.+' } } allprojects { repositories { jcenter() mavenCentral() maven { url "https://jitpack.io" } maven { url 'https://maven.fabric.io/public' } google() } ext { androidApplicationId = 'com.example' androidVersionCode = 1 androidVersionName = "1.1.0" } } task clean(type: Delete) { delete rootProject.buildDir }文件:app / build.gradle:
@H_403_9@apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { compileSdkVersion 25 buildToolsVersion "26.0.2" defaultConfig { multiDexEnabled true applicationId "com.example" minSdkVersion 21 targetSdkVersion 23 versionCode 1 versionName "1.0" renderscriptTargetApi 23 renderscriptSupportModeEnabled true } compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } lintOptions { quiet true abortOnError false ignoreWarnings true disable 'InvalidPackage' //Some libraries have issues with this. disable 'OldTargetApi' //Lint gives this warning but SDK 20 would be Android L Beta. disable 'IconDensities' //For testing purpose. This is safe to remove. disable 'IconMissingDensityFolder' //For testing purpose. This is safe to remove. } dexOptions { javaMaxHeapSize "8G" } packagingOptions { exclude 'LICENSE.txt' exclude 'Meta-INF/DEPENDENCIES.txt' exclude 'Meta-INF/LICENSE.txt' exclude 'Meta-INF/NOTICE.txt' exclude 'Meta-INF/NOTICE' exclude 'Meta-INF/LICENSE' exclude 'Meta-INF/DEPENDENCIES' exclude 'Meta-INF/notice.txt' exclude 'Meta-INF/license.txt' exclude 'Meta-INF/dependencies.txt' exclude 'Meta-INF/rxjava.properties' } sourceSets { main.java.srcDirs += 'build/generated/source/apt' } } repositories { flatDir { dirs 'libs' } } dependencies { implementation fileTree(dir: 'libs',include: ['*.jar']) implementation project(':library_api') implementation project(':library_base') implementation project(':library_blur_dialog') implementation project(':library_countrycodepicker_dialog') implementation project(':library_glow_decorator') implementation project(':library_icons') implementation project(':library_loopvideo') implementation project(':library_section_adaper') implementation project(':library_taptargetview') implementation project(':library_ucrop') implementation project(':library_utils') implementation project(':library_utils_picasso') implementation project(':library_vector_compat') implementation project(':library_view_clock') implementation project(':library_view_shimmer_recycler') implementation "com.google.android.gms:play-services-cast-framework:11.4.2" compileOnly 'com.google.android.wearable:wearable:2.0.3' implementation 'com.google.android.support:wearable:2.0.3' implementation 'com.google.android.exoplayer:exoplayer:r2.4.1' implementation "com.android.support:mediarouter-v7:25.4.0" implementation "com.android.support:leanback-v17:25.4.0" implementation "com.android.support:design:25.4.0" implementation "com.android.support:appcompat-v7:25.4.0" implementation "com.android.support:support-v4:25.4.0" implementation "com.android.support:gridlayout-v7:25.4.0" implementation "com.android.support:cardview-v7:25.4.0" implementation "com.android.support:recyclerview-v7:25.4.0" implementation "com.android.support:preference-v14:25.4.0" // rxjava implementation 'io.reactivex:rxjava:1.2.9' implementation 'io.reactivex:rxandroid:1.2.1' implementation 'com.github.davidmoten:rxjava-extras:0.8.0.6' // square "com.squareup.retrofit2:retrofit:2.1.0",implementation "com.squareup.retrofit2:converter-gson:2.1.0" implementation "com.squareup.retrofit2:adapter-rxjava:2.1.0" implementation "com.squareup.phrase:phrase:1.1.0" implementation "com.squareup.okhttp3:okhttp:3.6.0" implementation "com.squareup.okhttp3:logging-interceptor:3.6.0" implementation "com.squareup.okhttp3:okhttp-urlconnection:3.6.0" // picasso implementation "com.squareup.picasso:picasso:2.5.2" implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' // dagger implementation "com.google.dagger:dagger:2.10" annotationProcessor "com.google.dagger:dagger-compiler:2.10" implementation "javax.annotation:jsr250-api:1.0" implementation "javax.inject:javax.inject:1" // jake ftw implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' compileOnly 'org.projectlombok:lombok:1.16.16' annotationProcessor 'org.projectlombok:lombok:1.16.16' // FragmentWithArgs implementation "com.hannesdorfmann.fragmentargs:annotation:3.0.2",annotationProcessor "com.hannesdorfmann.fragmentargs:processor:3.0.2",implementation "org.parceler:parceler-api:1.1.9",annotationProcessor "org.parceler:parceler:1.1.9",implementation 'com.hannesdorfmann.fragmentargs:bundler-parceler:3.0.2' implementation "com.github.codekidX:storage-chooser:1.0.34" implementation 'io.github.yavski:fab-speed-dial:1.0.6' implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') { transitive = true; } // intent builder implementation "com.github.marcinmoskala.activitystarter:activitystarter:1.00" annotationProcessor "com.github.marcinmoskala.activitystarter:activitystarter-compiler:1.00" implementation 'com.android.support.constraint:constraint-layout:1.0.2'//constraint-layout implementation 'org.greenrobot:eventbus:3.0.0' //font implementation 'uk.co.chrisjenx:calligraphy:2.2.0' implementation 'com.github.florent37:expectanim:1.0.6' implementation 'com.romandanylyk:pageindicatorview:0.2.0@aar' implementation 'com.github.rubensousa:gravitysnaphelper:1.2' implementation 'com.flaviofaria:kenburnsview:1.0.7' implementation 'com.github.florent37:arclayout:1.0.2' implementation 'com.jakewharton.rxbinding:rxbinding:1.0.1' implementation 'com.wang.avi:library:2.1.3' implementation 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar' implementation 'com.borax12.materialdaterangepicker:library:1.9' implementation 'com.github.scottyab:showhidepasswordedittext:0.8' //Location implementation "com.google.android.gms:play-services-maps:11.4.2" implementation 'pl.charmas.android:android-reactive-location:0.10@aar' implementation "com.google.android.gms:play-services-location:11.4.2" //you can use newer GMS version if you need implementation "com.google.android.gms:play-services-places:11.4.2" implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar' implementation 'commons-validator:commons-validator:1.4.1' implementation 'com.balysv:material-ripple:1.0.2' implementation 'com.googlecode.libphonenumber:libphonenumber:8.5.2' implementation 'ru.egslava:MaskedEditText:1.0.5' implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5' implementation "com.google.firebase:firebase-core:11.4.2" implementation 'com.labo.kaji:swipeawaydialog:0.1.1' implementation 'io.supercharge:shimmerlayout:1.0.1' implementation 'hanks.xyz:htextview-library:0.1.5' implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'//progressbar for action bar implementation 'io.reactivex:rxjava-math:1.0.0' implementation 'jp.wasabeef:picasso-transformations:2.1.2' implementation 'com.afollestad.material-dialogs:core:0.9.1.0' implementation('com.github.ihsanbal:LoggingInterceptor:2.0.2') { exclude group: 'org.json',module: 'json' } } apply plugin: 'com.google.gms.google-services'申请类:
@H_403_9@public class TheApplication extends Application { ... }