本文介绍了由于android-apt插件,导致Android Studio 3.0上的Butterknife gradle错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到Android Studio 3.0后,我遇到了gradle问题,可以解决开发人员上的检查问题网站

After upgrading to Android Studio 3.0 I had some issues with gradle that I was able to fix checking on the developers website

但是,我找不到用apply plugin: 'android-apt'解决问题的方法,我尝试了几种方法,例如从项目gradle中删除它,并将其作为annotationProcessor 'com.neenbedankt.gradle.plugins:android-apt:1.8'添加到应用gradle中.还删除了apt等.

However, I was not able to find how to fix the issue with the apply plugin: 'android-apt' I have tried several things such as removing it from the project gradle and add it to the app gradle as annotationProcessor 'com.neenbedankt.gradle.plugins:android-apt:1.8' . also removed the apt, etc, etc.

无论如何,Studio都在抱怨它.任何帮助是极大的赞赏.谢谢!

Anyway, Studio is complaining about it. Any help is greatly appreciated. Thanks!

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.google.gms:google-services:3.1.1'

    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }

    ext {
        supportLibVersion = '27.0.0'
        firebaseLibVersion = '11.4.2'
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

APP GRADLE

APP GRADLE

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.0"
    defaultConfig {
        applicationId "xxxxxxxxxxxxxxxxxxxx"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        vectorDrawables.useSupportLibrary = true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    apply plugin: 'android-apt'
}

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

    compile "com.android.support:appcompat-v7:${supportLibVersion}"
.....

    compile 'com.google.android.gms:play-services-auth:11.4.2'

    compile 'com.jakewharton:butterknife:8.4.0'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'

}
apply plugin: 'com.google.gms.google-services'

推荐答案

不要使用apt插件,添加如下所示的依赖项:

Do not use apt plugin, add the dependency like this:

compile "com.jakewharton:butterknife:8.8.1"
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"

参考

这篇关于由于android-apt插件,导致Android Studio 3.0上的Butterknife gradle错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:50