Android Studio编译出错

2025-05-23 18:08:46
推荐回答(2个)
回答(1):

这个问题一般是你在app的build.gradle文件中的依赖库 选项,重复依赖了某些lib库

解决办法如下:

    

  1. 找到重复依赖的lib,删除该依赖的引用

  2. 尝试在 app 的build.gradle目录下 加入

    defaultConfig {
       multiDexEnabled true
    }

  3. 如果还不奏效尝试在app的build.gradle目录下加入

    packagingOptions {
       exclude 'META-INF/NOTICE' // will not include NOTICE file
       exclude 'META-INF/LICENSE' // will not include LICENSE file
       // as noted by @Vishnuvathsan you may also need to include
       // variations on the file name. It depends on your dependencies.
       // Some other common variations on notice and license file names
       exclude 'META-INF/notice'
       exclude 'META-INF/notice.txt'
       exclude 'META-INF/license'
       exclude 'META-INF/license.txt'
    }

回答(2):

请确定是否设置JAVA_HOME环境变量,以及JDK版本是否为1.7,不要使用JDK1.8。