Can't run nor debug project but gradle build+install work

心不动则不痛 提交于 2020-04-07 03:30:28

问题


After update to Android studio 3.6 Canary11 (macOS) I cannot run nor run Debug variants of my project (Release variants working fine).

When I try to run the project I've got error:

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
  > Entry name 'firebase-abt.properties' collided

But when I delete build directory (rm -rf app/build), I can run/debug project once time. After the first run, it is again with the same error with collision.

I try clear cache, restart the Android studio, but it didn't help.

Maybe it is not related to Android studio, because different project running ok. Do you have any idea, what the problem may be?


回答1:


I was facing the same error as MrEngineer13. After hours of struggle turns out you have to delete the built APK files for the project to build another APK successfully




回答2:


I just had a similar issue - my generating a debug build variant kept failing with an error about "Entry name res/layout/test_toolbar.xml collided". There is no "test_toolbar_xml" anywhere in my project. I first deleted all build directories and tried - same result. then I went in and deleted caches under .gradle\5.6.4, and under .idea folders. Tried again and this time I was able to build.

Building a "release" variant worked every time.




回答3:


I had a similar issue with Android Studio 3.6 Canary 12 on Mac, I could build different build variants but had this error when I tried to Generate a signed apk:

Entry name 'kotlin/collections/MapWithDefault.kotlin_metadata' collided

I had to delete the .build folder as well as the folders where I build my build variant.




回答4:


try build.gradle

android {
    packagingOptions {
    pickFirst  'firebase-abt.properties'
    }
}



回答5:


  1. After upgrading Gradle, compilation (debug) failed. I got the compilation error message:

Entry name 'res/mipmap-hdpi-v4/ic_launcher.png' collided

  1. Tried the article https://medium.com/@elye.project/resources-collision-without-warning-b29294f518c6 by Elye. I am using a library where ic_launcher is also defined. I renamed the ic_launcher according to recommendations in the article, but that did not solve the problem.

  2. Tried to clear the cache by deleting the build and gradle directory, but that did not solve the problem.

  3. Tried to set in gradle.properties:android.useNewApkCreator=false but then Android Studio reports: build.gradle: The option setting android.useNewApkCreator=false is experimental and unsupported.

  4. Since I am not up to using experimental features, I downgraded from:
    Gradle Version: 3.6.1 Android Plugin version: 6.2.1
    to:
    Gradle Version: 3.5.3 Android Plugin version: 5.4.1

Compilation (debug) now works again.



来源:https://stackoverflow.com/questions/57975595/cant-run-nor-debug-project-but-gradle-buildinstall-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!