Error:注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: Cannot merge new index 66353 into a non-jumbo instruction!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 20s
解决办法:
app/build.gradle
android {
...
lintOptions {
abortOnError false
}
dexOptions {
jumboMode true
}
}
root/build.gradle
buildscript {
...
}
allprojects {
...
}
task clean(type: Delete) {
...
}
tasks.withType(JavaCompile) {
// Try to turn them all off automatically
options.compilerArgs << '-Xlint:none'
options.compilerArgs << '-nowarn' // same as '-Xlint:none'
// Turn them off manually
options.compilerArgs << '-Xlint:-auxiliaryclass'
options.compilerArgs << '-Xlint:-cast'
options.compilerArgs << '-Xlint:-classfile'
options.compilerArgs << '-Xlint:-deprecation'
options.compilerArgs << '-Xlint:-dep-ann'
options.compilerArgs << '-Xlint:-divzero'
options.compilerArgs << '-Xlint:-empty'
options.compilerArgs << '-Xlint:-fallthrough'
options.compilerArgs << '-Xlint:-finally'
options.compilerArgs << '-Xlint:-options'
options.compilerArgs << '-Xlint:-overloads'
options.compilerArgs << '-Xlint:-overrides'
options.compilerArgs << '-Xlint:-path'
options.compilerArgs << '-Xlint:-processing'
options.compilerArgs << '-Xlint:-rawtypes'
options.compilerArgs << '-Xlint:-serial'
options.compilerArgs << '-Xlint:-static'
options.compilerArgs << '-Xlint:-try'
options.compilerArgs << '-Xlint:-unchecked'
options.compilerArgs << '-Xlint:-varargs'
在app/build.gradle添加:
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
在root/build.gradle修改:
buildscript {
...
}
allprojects {
...
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: Cannot merge new index 66353 into a non-jumbo instruction!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 20s
解决办法:
app/build.gradle
android {
...
lintOptions {
abortOnError false
}
dexOptions {
jumboMode true
}
}
root/build.gradle
buildscript {
...
}
allprojects {
...
}
task clean(type: Delete) {
...
}
tasks.withType(JavaCompile) {
// Try to turn them all off automatically
options.compilerArgs << '-Xlint:none'
options.compilerArgs << '-nowarn' // same as '-Xlint:none'
// Turn them off manually
options.compilerArgs << '-Xlint:-auxiliaryclass'
options.compilerArgs << '-Xlint:-cast'
options.compilerArgs << '-Xlint:-classfile'
options.compilerArgs << '-Xlint:-deprecation'
options.compilerArgs << '-Xlint:-dep-ann'
options.compilerArgs << '-Xlint:-divzero'
options.compilerArgs << '-Xlint:-empty'
options.compilerArgs << '-Xlint:-fallthrough'
options.compilerArgs << '-Xlint:-finally'
options.compilerArgs << '-Xlint:-options'
options.compilerArgs << '-Xlint:-overloads'
options.compilerArgs << '-Xlint:-overrides'
options.compilerArgs << '-Xlint:-path'
options.compilerArgs << '-Xlint:-processing'
options.compilerArgs << '-Xlint:-rawtypes'
options.compilerArgs << '-Xlint:-serial'
options.compilerArgs << '-Xlint:-static'
options.compilerArgs << '-Xlint:-try'
options.compilerArgs << '-Xlint:-unchecked'
options.compilerArgs << '-Xlint:-varargs'
}
或者在app/build.gradle添加:
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
在root/build.gradle修改:
buildscript {
...
}
allprojects {
...
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}