gradle插件升级到3.2.1产生的一些bug

1,Android Studio3.0之后不需要再指定buildToolsVersion,每个版本的Android Gradle插件都有默认版本的构建工具,删掉就行。

 

 

2,The `android.dexOptions.incremental` property is deprecated and it has no effect on the build process.

原因:android.dexOptions.incremental属性已被弃用,它对构建过程没有影响。

 

解决:删除  incremental true 

dexOptions {

        incremental true //这个去掉

        javaMaxHeapSize "4g"

}

 

3,Error:com.android.builder.merge.DuplicateRelativeFileException:More than one file was found with OS independent path 'META-INF/DEPENDENCIES'

解决方案:
在报错的module下的build.gradle文件中加入如下配置:
    android{
       //处理所有报META-INF/*'的错误
       packagingOptions {
            pickFirst 'META-INF/*'
       }
    }

 

4,将项目导入到AS中出现以下问题:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.bui

解决方法:
在build.grade中添加以下代码:

android{

packagingOptions {

exclude 'META-INF/DEPENDENCIES.txt'

exclude 'META-INF/NOTICE'

exclude 'META-INF/NOTICE.txt'

exclude 'META-INF/LICENSE'

exclude 'META-INF/LICENSE.txt'

        }

}

 

sVersion '28.0.3

5,More than one file was found with OS independent path 'META-INF/ASL2.0'

 

添加下面的即可 android {
        defaultConfig {
    
            packagingOptions {
                pickFirst 'META-INF/*'
             }
        }}

 

 

6,Android resource linking failed

TICE' 将 改为即可,

 

7,android.enableAapt2=false在2018年底已弃用,发现这种问题,试试升级到最新版本.

 

 

8,依赖重复

8.1Program type already present: android.support.v4.app.BackStackRecord

8.2,Program type already present: android.support.v4..

阐述:集成同盾指纹识别时,报上面2个错误

原因:依赖冲突

解决

1,第一种方式,粗暴剔除重复依赖

gradle插件升级到3.2.1产生的一些bug_第1张图片

2,第二种方式

其他解决冲突博客:

https://blog.csdn.net/richiezhu/article/details/80320185

https://blog.csdn.net/jinjins1129/article/details/51014303

 

优秀文章:

1,Android开发各类常见错误解决方案

你可能感兴趣的:(异常情况)