Android项目同时使用AndroidX库和bufferknife库报错: package android.support.annotation does not exist 

    原因:谷歌使用AndroidX扩展库代替老的Android支持库,androidx库中annotation.jar包的包名由android.support.annotation变为androidx.annotation,而bufferknife8.8.1之前一直调用的是android.support.annotation支持库,而使用androidx代替android.support后,导致annotation.jar里的一些类找不到,比如:

    解决办法:应调用bufferknife:9.0.0-rc1以上版本,在Module  build.gradle里修改:

dependencies {        implementation 'com.jakewharton:butterknife:10.0.0'    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'}

在Project  build.gradle里修改:

 dependencies {        classpath 'com.android.tools.build:gradle:3.3.0'        classpath 'com.jakewharton:butterknife-gradle-plugin:10.0.0'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }

  可以参考GitHub上的解决方案:https://github.com/JakeWharton/butterknife/issues/1296  

   如有不足欢迎指正。于2018年11月9日

 

更多相关文章

  1. 高级Redis应用进阶课 一站式Redis解决方案
  2. 【Android】 Eclipse : ERROR: Unknown option '--no-crunch'的
  3. android常见异常
  4. 关于android studio IDE升级到3.0之后出现的配置和项目兼容问题
  5. Android(安卓)MediaPlayer播放异常问题汇总
  6. android全格式多媒体播放器(三:基于ffmpeg架构的具体实现)
  7. activity打开时不自动弹出软键盘
  8. Android(安卓)Studio的APP目录下的build.gradle的配置说明
  9. android 开发故障记录

随机推荐

  1. android app内存使用限制
  2. 为什么Android的AsyncTask不适合执行长时
  3. Android实现拨打电话功能
  4. Android(安卓)Service Messenger & AIDL
  5. 下载CyanogenMod 7.2 for Motorola Defy
  6. 27、android log日志
  7. android内存溢出处理方式之一
  8. strcpy函数在android中的实现
  9. 浅谈android手机客户端开发
  10. 解决Popupwindow挡住软键盘问题