Android studio 3.0 版本的出现的bug

android-apt plugin is incompatible with future version of Android Gradle plugin. use ‘annotationPro

Warning:android-apt plugin is incompatible with future version of Android Gradle plugin. Please use ‘annotationProcessor’ configuration instead.

原因:更新Android studio 原来项目出现问题。
分析: 尤其是采用butterknife工具的,采用新的Android Studio都会出现这样的问题,本人根据提示最后猜测原因可能是Android studio更新,然后gradle更新了,这样的话可能使原来的android-apt 工具跟不上节奏了,所以让采用annotationProcessor工具。
解决: 把project下的build.gradle 当中的依赖

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’ 


    }
}

修改成如下:

buildscript { 
repositories { 
 jcenter()
 mavenCentral()
 google()
} 
dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1'
       classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'
} 
} 

然后再把module下的build.gradle :

dependencies { 

compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

compile ‘com.android.support:appcompat-v7:25.3.1’

compile ‘com.jakewharton:butterknife:8.5.1’ 
apt ‘com.jakewharton:butterknife-compiler:8.5.1’

} 

修改如下:

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

compile ‘com.android.support:appcompat-v7:25.3.1’

compile ‘com.jakewharton:butterknife:8.5.1’ 
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.5.1’ 
} 

再把 apply plugin: ‘com.android-apt ’ 这个引用给删除。
重新reBuild的一下

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值