Kotlin Kapt失败 - 只看到android api 1级来源

时间:2017-11-01 21:48:01

标签: android android-gradle kotlin kapt

我看到一些奇怪的行为导致:app:kaptQaDebugKotlin在尝试升级到android gradle插件3.0时失败。

  • 使用@TargetApi(VERSION_CODES.KITKAT)注释的方法因cannot find symbolVERSION_CODES.KITKAT
  • 而失败
  • ...但VERSION_CODES.KITKAT与方法一起使用时已找到
  • 找不到符号DialogInterface.OnShowListener(在API级别8中添加)
  • ..但找到DialogInteface.OnClickListener(在API级别1中添加)
  • 找不到符号Application.ActivityLifecycleCallbacks(在api level 14中添加)
  • 注意:Android Studio可以查看所有这些cannot find symbol类的来源(cmd + B有效)

版本

  • compileSdkVersion:25
  • buildTools:26.0.2
  • Kotlin版本:1.1.51
  • AGP:3.0.0
  • gradle wrapper:4.3
  • 支持lib:24.2.1(也很难升级,但我确实试过25.4.0但仍然没有运气)
  • Dagger:2.0.2(坚持这个旧版本,不幸升级不了)
  • 使用AGP 3.0.0 java 8 desugar功能
  • 使用kotlin-kapt插件。正确生成了autovalue类。

知道发生了什么事吗?看起来kapt任务以某种方式使用android api level 1来源,我不知道如何解决这个问题

1 个答案:

答案 0 :(得分:0)

Per @pentarex

  

错误来自外部库logback-android-classic,我不得不排除组:' com.google.android',模块:' android

implementation(libs.logbackAndroidClassic){
    exclude group: 'com.google.android', module: 'android'
}