Android编译错误整理集

1、合并Mianifest清单文件失败


Manifest failed Manifest merger failed with multiple errors, see logs

一般有以下几种情况:
1、清单文件有错;
2、引入的三方包存在冲突(如:名称相同,icon相同等…)
3、SDK版本冲突(如:minSdkVersion、compileSdkVersion版本不一致等…)
一般有以下几种情况:
1、清单文件有错;
2、引入的三方包存在冲突(如:名称相同,icon相同等…)
3、SDK版本冲突(如:minSdkVersion、compileSdkVersion版本不一致等…)

&&  compileSdkVersion   --编译SDK版本(当前使用的API等级)
    buildToolsVersion   --build构建工具版本(与compileSdkVersion之间有对应关系)
    minSdkVersion       --最低使用SDK版本,即:最低能使用的API等级(project中主model的minSdkVersion不能低于其他model)
    targetSdkVersion    --目标SDK版本(并没有实质性的作用,高于minSDKVersion即可)
    (修改以后记得clear Project)

2、编译失败


Error:Compilation failed; see the compiler error output for details.

在studio控制台输入:

  • gradlew compileDebugSources –stacktrace -info

显示详细的错误信息。


3、jar包冲突


Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:

找到具体冲突的jar包:
1、删除jar。
2、在 implementation 依赖后面添加 exclude module xxx。
例如:

implementation('com.android.support:appcompat-v7:23.3.0') {
            exclude module: 'support-v4'
}

或者在工程目录的build下删除除

allprojects {
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
    }
}
&& studio查看依赖树:
    gradlew -q :app:dependencies
(如没有执行权限,需增加执行权限。chmod +x gradlew)

4、libs下 armeabi文件中的 .so 文件加载错误


Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
...

解决方法:

android{
    //Add the following configuration

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

&& 加载libs下的.so文件

sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}

&& 加载子模块libs下的文件

repositories{
    flatDir{
        dirs '../ads_sdk_baidu_dap/libs'
    }
}

5、导入工程出错


Error:(1, 0) Plugin with id 'com.android.application' not found

如果你的project中没有全局配置的build.gradle,那么在模块的build.gradle中加入:

android{...}

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

    }
}

repositories {
    google()

    maven {
        url 'http://repo1.maven.org/maven2'
    }
}

如果项目编译通过,但是无法运行。app模块有红叉:

  • 可以尝试删除app.iml与project.iml这两个临时文件,然后关闭项目,重新打开编译。

6、java.io.IOException: Please correct the above warnings first.

这里写图片描述

解决方法:
在proguard-rules.pro这个混淆文件中加一行:

-ignorewarnings

编译通过。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值