任务':app:transformClassesWithDexBuilderForDevDebug'的执行失败

时间:2018-11-30 07:26:10

标签: java android android-studio gradle android-gradle

我在将其从gradle中删除之前使用了Metrolambda,因为有警告提示我这样做。

然后,在编译项目时出现此错误。

  

org.gradle.api.tasks.TaskExecutionException:任务执行失败   ':app:transformClassesWithDexBuilderForDevDebug'。在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)     在   org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)     在   org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)     在   org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)     在   org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)     在   org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)     在   org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)     在   org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)     在   org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)     在   org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)     在   org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)     在   org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)     在   org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)     在   org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:256)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)     在   org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)     在   org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200(DefaultTaskPlanExecutor.java:79)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:104)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:98)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)     在   org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)     在   org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在   org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)     在java.lang.Thread.run(Thread.java:745)造成原因:   java.lang.RuntimeException:   com.android.build.api.transform.TransformException:   java.lang.RuntimeException:java.lang.RuntimeException在   com.android.builder.profile.Recorder $ Block.handleException(Recorder.java:55)     在   com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)     在   com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)     在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)在   org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)在   org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:50)     在   org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)     在   org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:124)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)     ... 33更多原因:   com.android.build.api.transform.TransformException:   java.lang.RuntimeException:java.lang.RuntimeException在   com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:427)     在   com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:239)     在   com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:235)     在   com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)     ... 49更多原因:java.lang.RuntimeException:   java.lang.RuntimeException在   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     在java.lang.reflect.Constructor.newInstance(Constructor.java:423)     在   java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)     在   java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)     在java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)在   com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)     在   com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getInitalGraphData(DesugarIncrementalTransformHelper.java:162)     在   com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.makeDesugaringGraph(DesugarIncrementalTransformHelper.java:130)     在   com.google.common.base.Suppliers $ NonSerializableMemoizingSupplier.get(Suppliers.java:160)     在   com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.getDependenciesPaths(DesugarIncrementalTransformHelper.java:231)     在   com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.getD8DesugaringCacheInfo(DexArchiveBuilderTransform.java:461)     在   com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:375)     ... 52更多原因:java.lang.RuntimeException   org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148)在   org.objectweb.asm.ClassReader.readModule(ClassReader.java:731)在   org.objectweb.asm.ClassReader.accept(ClassReader.java:632)在   org.objectweb.asm.ClassReader.accept(ClassReader.java:500)在   com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:144)     在   com.android.builder.desugaring.DesugaringClassAnalyzer.analyzeJar(DesugaringClassAnalyzer.java:92)     在   com.android.builder.desugaring.DesugaringClassAnalyzer.analyze(DesugaringClassAnalyzer.java:63)     在   com.android.build.gradle.internal.transforms.DesugarIncrementalTransformHelper.lambda $ getInitalGraphData $ 4(DesugarIncrementalTransformHelper.java:150)     在   java.util.concurrent.ForkJoinTask $ AdaptedCallable.exec(ForkJoinTask.java:1424)     在java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)     在   java.util.concurrent.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1056)     在   java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)     在   java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

我在项目中使用了lambda,这就是我的成就

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1811001 //yyMMxxx //xxx is number of production
        versionName "0.1.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions "mine"
    productFlavors {
        dev {
            dimension "mine"
            applicationIdSuffix ".dev"
            versionNameSuffix "-dev"
            resValue "string", "app_name", "Development"
            multiDexEnabled true
        }
        staging {
            dimension "minw"
            applicationIdSuffix ".staging"
            versionNameSuffix "-staging"
            resValue "string", "app_name", "Staging"
            multiDexEnabled true
        }
        prod {
            dimension "mine"
            resValue "string", "app_name", "App"
            multiDexEnabled true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    //map
    implementation 'net.sharewire:google-maps-clustering:0.1.3'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'

    //ViewModel and LiveData
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'

    //navigation
    implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha07'
    implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha07'

    //room
    implementation 'androidx.room:room-runtime:2.0.0'
    annotationProcessor 'androidx.room:room-compiler:2.0.0'

    //retrofit + okhttp
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
    implementation 'com.squareup.okio:okio:1.14.1'

    //butterknife
    implementation 'com.jakewharton:butterknife:9.0.0-rc1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'

    //tedPermission
    implementation 'gun0912.ted:tedpermission:2.2.2'

    //materialDialog
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'

    //picasso
    implementation 'com.squareup.picasso:picasso:2.71828'

    //iconic
    implementation 'com.mikepenz:iconics-core:3.1.0'
    implementation 'com.mikepenz:iconics-views:3.1.0'
    implementation 'com.mikepenz:google-material-typeface:3.0.1.3.original@aar'
    implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.5@aar'
    implementation 'com.mikepenz:fontawesome-typeface:5.3.1.1@aar'

    //roundedImageView
    implementation 'com.makeramen:roundedimageview:2.3.0'

    //lombok
    compileOnly 'org.projectlombok:lombok:1.18.0'
    annotationProcessor 'org.projectlombok:lombok:1.18.0'

    //nav
    implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.2'

    //circleIV
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    //location
    implementation "io.nlopez.smartlocation:library:3.3.3"
    implementation "com.google.android.gms:play-services-location:16.0.0"
    implementation "com.emreeran.locationlivedata:locationlivedata:1.0.4"

    //swipebutton
    implementation 'com.ncorti:slidetoact:0.3.0'

    //zxing
    implementation "me.dm7.barcodescanner:zxing:1.9.8"

    //face recognition
    implementation 'org.bytedeco:javacv:1.4.3'
    implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-arm'
    implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-x86'
    implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.0.2-1.4.3', classifier: 'android-arm'
    implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.0.2-1.4.3', classifier: 'android-x86'

    //eventbus
    implementation 'org.greenrobot:eventbus:3.1.1'

    //conntection
    implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1-alpha01'
}

我希望有解决此问题的方法。

0 个答案:

没有答案