记录下使用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,可能出现不兼容的情况,未完善和多维测试吧。

最后重新编译下,可以编译成功!

 

更多相关文章

  1. Android中的compileSdkVersion,minSdkVersion,targetSdkVersion和b
  2. ANDROID学习之路
  3. android
  4. startActivity exposed beyond app through Intent.getData()
  5. [Android] Android(安卓)使用 Greendao 操作 db sqlite(1)-- 直
  6. android webview 使用
  7. 【android】shape的使用
  8. ToolBar的使用
  9. Android避免启动时闪一下黑屏

随机推荐

  1. Android(安卓)图表开源框架之MPAndroidCh
  2. android开发每日汇总【2011-12-3】
  3. Android本地视频播放器开发--SDL编译
  4. Android之不要滥用SharedPreferences
  5. Android简明开发教程二十二:使用资源Resou
  6. Android(安卓)layout常见的属性大全
  7. Android简明开发教程二十二:使用资源Resou
  8. Android(安卓)API中文文档Button
  9. android中点击事件的4种写法
  10. Android开发软件