Android(安卓)编译App报错 找不到android.support.annotation.Keep的类文件
记录下使用Tinker官方的 Sample工程 tinker-sample-android,导入Android studio,然后运行起来报错的问题:
> Task :app:compileDebugJavaWithJavac FAILED
Gradle may disable incremental compilation as the following annotation processors are not incremental: tinker-android-anno-1.9.14.5.jar (com.tencent.tinker:tinker-android-anno:1.9.14.5).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
错误: 无法访问Keep
找不到android.support.annotation.Keep的类文件
1 个错误
> Task :app:mergeExtDexDebug
> Task :app:mergeDebugNativeLibs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
------------------------------------------------------------------------------------------------------------
PS:Tinker,它是微信官方的 Android 热补丁解决方案,它支持动态下发代码、So 库以及资源,让应用能够在不需要重新安装的情况下实现更新。
解决:
在工程目录下gradle.properties添加
#表示将依赖包也迁移到AndroidXandroid.enableJetifier=true
这里如果取值为 false ,表示不迁移依赖包到AndroidX,但在使用依赖包中的内容时可能会出现问题,当然了,如果你的项目中没有使用任何三方依赖,那么,此项可以设置为 false。
照理说现在项目应该都要默认支持AndroidX了,这边Sample示例工程也是近期才迁移到AndroidX,可能出现不兼容的情况,未完善和多维测试吧。
最后重新编译下,可以编译成功!
更多相关文章
- Android中的compileSdkVersion,minSdkVersion,targetSdkVersion和b
- ANDROID学习之路
- android
- startActivity exposed beyond app through Intent.getData()
- [Android] Android(安卓)使用 Greendao 操作 db sqlite(1)-- 直
- android webview 使用
- 【android】shape的使用
- ToolBar的使用
- Android避免启动时闪一下黑屏