我已经有3个星期的问题了。我无法建立我的项目,因为这个问题

时间:2018-04-27 04:37:15

标签: android

我得到了答案,但答案无法帮助我。我想要一个详细的答案。这是第一个问题。程序显示“app:transferformDexArchiveWithExternalLibsDexMergerForDebug”

org.gradle.api.tasks.TaskExecutionException: Execution;

    failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at 

第二个问题。

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)

并且,最后的问题。

Caused by: com.android.tools.r8.utils.AbortException
    at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
    at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)
    ... 131 more

这是我的build.gradel。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.nsc.apk.herb4health"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        defaultConfig {
            multiDexEnabled true
        }


    }

    buildTypes {
        release {
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
        }
    }


    packagingOptions {
        exclude 'META-INF/LICENSE-FIREBASE.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/LGPL2.1'
    }

}




dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    implementation supportDependencies.appCompat
    implementation supportDependencies.recycler
    implementation supportDependencies.cardView
    implementation supportDependencies.kitCore

    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'

    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:cardview-v7:27.1.1'

    // RecyclerView
    implementation 'com.android.support:recyclerview-v7:27.1.0'

    // For Cover Flow
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.moondroid.coverflow:library:1.0'
    implementation 'com.flaviofaria:kenburnsview:1.0.7'
    implementation 'com.github.florent37:diagonallayout:1.0.7'

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.3.1'

    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.karumi:dexter:2.3.1'

    implementation 'com.github.kittinunf.fuel:fuel-android:1.3.1'
    implementation 'com.github.medyo:android-about-page:1.1.1'
    implementation 'com.mani:ThinDownloadManager:1.2.7'

    implementation 'com.github.thomper:sweet-alert-dialog:v1.4.0'
    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.google.firebase:firebase-database:15.0.0'
    implementation 'com.google.firebase:firebase-storage:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    implementation 'com.google.firebase:firebase-auth:15.0.0'
    implementation 'com.firebase:firebase-client-android:2.5.2'
    implementation 'com.firebaseui:firebase-ui-auth:3.3.0'


    implementation 'com.r0adkll:slidableactivity:2.0.6'
    implementation 'com.github.jrvansuita:MaterialAbout:+'
    implementation 'com.github.jrvansuita:IconHandler:v2.0.0'


    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.intellij:annotations:12.0'
    implementation "com.google.android.gms:play-services-gcm:15.0.0"

    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'com.r0adkll:deadskunk:1.0.4-SNAPSHOT'
    annotationProcessor 'org.immutables:value:2.4.4'

    //ADD Library for Stack card view
    implementation 'in.arjsna:swipecardlib:1.0.2'
    //DetailBodyhumen
    //Circle Image View
    implementation 'de.hdodenhof:circleimageview:2.1.0'

    implementation('com.google.api-client:google-api-client-android:1.20.0') {
        exclude module: 'guava-jdk5'
    }





    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

我的Android Show Build Monitor。

Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Caused by: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex;

引起:com.android.dex.DexException:多个dex文件定义Lorg / jetbrains / annotations / NotNull;

这个build.gradel(项目名称)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.roomVersion = '1.0.0'
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }


    dependencies {
        classpath(
                'junit:junit:4.12'
        )
        classpath(
                'org.junit.jupiter:junit-jupiter-api:5.1.0'
        )
        classpath(
                'org.junit.jupiter:junit-jupiter-engine:5.1.0',
                'org.junit.vintage:junit-vintage-engine:5.1.0'
        )
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath "me.tatarka:gradle-retrolambda:3.7.0"
        classpath ('com.google.firebase:firebase-plugins:1.1.0') {
            exclude group: 'com.google.guava', module: 'guava-jdk5'
        }


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
        classpath 'com.google.gms:google-services:3.2.0'


        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.1.0'


    }

}

allprojects {
    repositories {
        jcenter()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.fabric.io/public' }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
ext {
    //App
    libraryCode = 1
    libraryVersion = "1"

    //Support and Build tools version
    compileSdk = 26
    targetSdk = 26
    minSdk = 14
    buildTools = '27.0.1'
    supportLibrary = '25.4.0'
    ftKit = '0.5.1'

    //Support Libraries dependencies
    supportDependencies = [
            support       : "com.android.support:support-v4:${supportLibrary}",
            appCompat     : "com.android.support:appcompat-v7:${supportLibrary}",
            recycler      : "com.android.support:recyclerview-v7:${supportLibrary}",
            cardView      : "com.android.support:cardview-v7:${supportLibrary}",
            kitCore       : "com.52inc:52Kit-core:${ftKit}"
    ]

}

我曾经按照这些步骤操作,但不行。 Android studio warning - InnerClass annotations are missing corresponding EnclosingMember annotations

2 个答案:

答案 0 :(得分:0)

这是因为您在项目中导入了过时的库。您可以做的是将所有库更新到最新版本...或者创建另一个项目并找出哪个库正在产生问题

答案 1 :(得分:0)

添加可能与compileSdkVersion不兼容的外部库时会发生此错误。

首先更新,清理并重建应用程序,如果还没有修复,请按照以下链接。

https://stackoverflow.com/a/48531191/6920195