Tears_fg

导航

AndroidStudio编译失败问题汇总

场景一:

 Androidstudio使用assembleRelease打正式包报错。

BuildConfig is defined multiple times
或者

Multiple dex files define Lcom/xxx/xxx/BuildConfig 

问题原因:module包名与app包名写的一致。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"

    package="com.sport007.android">

问题解决::

  1. 重写module中的包名
  2. 删除所有build文件,重新编译

  执行了上述步骤,很有可能还是会报错,module中的R文件一直默认是App的。然后执行第三步

  3. 删除res文件,重新创建res下所有文件。

现在编译打包即正常。

 场景二:编译失败

问题一

 

 org.gradle.internal.service.ServiceCreationException: Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().

 问题二:KAPT编译失败

Kotlin could not find the required JDK tools in the Java installation '/Libr

解决:修改gradle jdk 

问题三:

编译报如下错误。

Cannot lock Java compile cache as it has already been locked by this process

怎么清理缓存,删除build都没用。

解决:

1.命令行查询java进程。

$ jps

2.杀死GradleDaemon进程。

$ kill ${进程ID}

重新同步项目即可解决。

参考:

Cannot lock Java compile cache as it has already been locked by this process

 

posted on 2022-06-17 11:51  Tears_fg  阅读(2470)  评论(0编辑  收藏  举报