标签: android-apt

升级到Android Studio 2.3后,android-apt的插件不兼容

从2.2升级到2.3后,我看到了这个警告

在此输入图像描述

当我尝试编译项目时,我看到了这个编译错误

在此输入图像描述

如何在不降级到之前的gradle版本的情况下解决此问题?是否有任何更新的android-apt可以解决这个问题?

android gradle android-studio android-apt

97
推荐指数
4
解决办法
7万
查看次数

使用android-apt插件时,新的Jack工具链崩溃了

我正在尝试使用新的Jack工具链构建一个简单的项目.我的项目依赖于android-apt插件(它使用了一些注释处理工具,但是在我尝试添加此工具之前发生了构建错误).这是我的模块构建脚本(我使用的是Android Studio 1.3gradle插件1.3.0):

apply plugin: 'com.android.application'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
    }
}
apply plugin: 'android-apt'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.netimen.ui.demo"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        useJack=true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
}
Run Code Online (Sandbox Code Playgroud)

当我尝试同步我的项目时,我得到以下ouptup:

Error:Could not find property 'options' on task ':demo:compileDebugJavaWithJack'.
Run Code Online (Sandbox Code Playgroud)

当我尝试运行时,gradlew …

android gradle android-jack-and-jill android-apt

21
推荐指数
2
解决办法
5614
查看次数

使用annotationProcessor而不是android-apt的Dagger 2与Android Studio 3.0 Preview(Canary 2)

"A long time ago in a galaxy far, far away...."
Run Code Online (Sandbox Code Playgroud)

好吧,长话短说 - 我决定尝试Android Studio 3.0 Preview (Canary 2)一下,我不能Dagger 2使用annotationProcessor而不是使用它android-apt.

我得到的错误消息是一个简单的消化:

Error:(59, 24) error: cannot find symbol variable DaggerAppComponent
Run Code Online (Sandbox Code Playgroud)

我已经阅读了文档(我想没有什么花哨的):https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#annotationProcessor_config

并将build.gradle文件更改为:

implementation "com.google.dagger:dagger:$rootProject.ext.daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.ext.daggerVersion"
Run Code Online (Sandbox Code Playgroud)

哪里 daggerVersion = '2.11'

此外,我确保在Android Studio中检查了相应的选项(默认情况下未选中):

File -> Other Settings -> Default Settings -> 
Build, Execution, Deployment -> Compiler -> Annotation Processors -> 
Enable annotation processors -> IS CHECKED
Run Code Online (Sandbox Code Playgroud)

不幸的是,它没有帮助.

摇篮:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
Run Code Online (Sandbox Code Playgroud)

Gradle的Android插件: …

android dagger-2 android-apt annotation-processor android-studio-3.0

14
推荐指数
1
解决办法
2773
查看次数

annotationprocessor和apt配置等价物

我正在使用AndroidAnnotaion,但由于Android Studio 2.3和Gradle 2.3.0,他们说android-apt已经过时了.而且annotationProcessor是一个新的.所以,我想知道我怎么能annotationProcessorapt以前一样配置.

如果我误解了什么,请帮忙.

所以,之前......

apply plugin: 'android-apt'

dependencies {

    def AAVersion = '4.2.0'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

apt {
    arguments {
        library 'true'
    }
}
Run Code Online (Sandbox Code Playgroud)

现在...

dependencies {

    def AAVersion = '4.2.0'
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}
Run Code Online (Sandbox Code Playgroud)

android android-annotations android-gradle-plugin android-apt annotation-processor

8
推荐指数
1
解决办法
4091
查看次数

Android Studio 2.3更新:警告:使用不兼容的插件进行注释处理:android-apt.这可能会导致意外行为

所以,我已经阅读了本网站上有关此问题的所有问题.我还与一位有类似问题的开发人员聊天,他能够解决这个问题.

我没有在我的gradle脚本中编写apt或annotationProcessor.

我的代码中没有任何地方写过android-apt这个词.我甚至继续检查了所有的库.这包含在我的项目中.

这是一个非常大的问题,需要解决.

我在下面附加修改后的build.gradle,请建议:

    apply plugin: 'com.android.application'
apply plugin: 'realm-android'


android {
    dexOptions {
        jumboMode = true
    }

    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion


    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.legalimpurity.indiancourts"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName

        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true;
    }
    buildTypes {
        release {
//            minifyEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    signingConfigs {
    }

    dataBinding {
        enabled = true
    }



}
//For Facebook i guess
repositories {
    mavenCentral()
    maven {
        url "https://jitpack.io"
    }
    maven { …
Run Code Online (Sandbox Code Playgroud)

android android-apt annotation-processor

7
推荐指数
2
解决办法
4510
查看次数

Android Studio 3.0错误:android-apt不兼容

我是Android开发的新手,并获得了一个遗留项目.所以我安装了最新版本的Android Studio并打开它.

当我尝试构建它时,我收到此错误:

Error:android-apt plugin is incompatible with the Android Gradle plugin.  Please use 'annotationProcessor' configuration instead.
Run Code Online (Sandbox Code Playgroud)

我正在尝试这些线程中显示的解决方案,但它没有用.

我的grandle构建脚本上没有任何android-apt参考.

许多编译包显示为过时.但是,当我按照Android的工作室建议更新参考时,我得到错误,说找不到包.

正如我所说的,我是Android Studio World的新手,所以我对这些东西都有些失落.

这是我的build.gradle(模块:app):

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"


    defaultConfig {
        applicationId "xxxxxxxxxxxx"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 123
        versionName "1.2.3"
        manifestPlaceholders = [HOCKEYAPP_APP_ID: "xxxxxxxxxxxxxxxxxxxxx"]

        //For Test
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions { …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio android-apt realm-java

5
推荐指数
1
解决办法
7403
查看次数

Android Studio中的Gradle构建错误

我在Android Studio 1.2.2中构建Android项目时遇到以下错误(全新安装)

Error:(76, 0) Could not find property 'unitTestVariants' on com.android.build.gradle.internal.dsl.TestOptions_Decorated@261be0aa.
Run Code Online (Sandbox Code Playgroud)

Gradle版本是2.4

Android build gradle版本是1.2.3

Android-apt版本是1.4

Android SDK版本为19.

android gradle android-studio android-gradle-plugin android-apt

5
推荐指数
1
解决办法
4579
查看次数

无法让android-apt工作

已经两次我已经尝试让android-apt工作了,因为我想要使用的第三方库(AndroidAnnotations和PermissionsDispatcher)需要它,并且两次我把头撞到墙上直到我厌倦了听到压扁声音.

问题?Android Studio无法找到或获取依赖项:

Error:Could not find com.neenbedankt.gradle:plugins:android-apt.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
    https://jcenter.bintray.com/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
    https://jcenter.bintray.com/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
    https://repo1.maven.org/maven2/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
    https://repo1.maven.org/maven2/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
Required by:
    :MaterialQuoter:unspecified
Run Code Online (Sandbox Code Playgroud)

我可能做了某种可笑的错误的(我的意思是,这些库将不会看到任何用途,否则,对吧?),但我不能看到我在做什么错.

我正在运行Android Studio 1.4,以防它以某种方式相关.

这是项目的gradle文件:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.neenbedankt.gradle:plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        mavenLocal()
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

dependencies {
    compile 'com.github.hotchemi:permissionsdispatcher:1.2.1'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:1.2.1'
}
Run Code Online (Sandbox Code Playgroud)

这是我主要处理的模块的gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId …
Run Code Online (Sandbox Code Playgroud)

android android-apt

5
推荐指数
1
解决办法
7966
查看次数