当你打开一个项目,编译的时候提示方法过时,提示信息如下:
Error:注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
-
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
从这个返回信息,我们是找不到任何有价值的错误信息的。 在bulid.gradle文件中的allprojects{}区块添加如下代码: allprojects{ ...<原有的代码> gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } }
再重新编译,就能发现问题了