安卓注解Gradle警告

3

我正在使用Android Studio 1.1 beta 4gradle插件1.0.1,并尝试按照官方说明将Android Annotations添加到我的项目中。因此,我得到了以下build.gradle文件:

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

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "ru.itloft.moneytracker"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    packagingOptions {
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
    }
}
def AAVersion = '3.2'
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
}
apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        // if you have multiple outputs (when using splits), you may want to have other index than 0

        resourcePackageName 'ru.itloft.moneytracker'

        // If you're using Android NBS flavors you should use the following line instead of hard-coded packageName
        // resourcePackageName android.defaultConfig.packageName

        // You can set optional annotation processing options here, like these commented options:
        // logLevel 'INFO'
        // logFile '/var/log/aa.log'
    }
}

所有功能都正常,但我在androidManifestFile variant.outputs[0].processResources.manifestFile这行收到一个警告,警告内容是:'org.codehaus.groovy.runtime.DefaultGroovyMethods'中的'getAt'不能应用于'(java.lang.Integer)'。 我该如何消除此警告?


2
你说的是 gradle 1.0.1。但我猜这不是你的 Gradle 版本,而是 Gradle Android 插件版本,对吗? - WonderCsabo
我在最新的Android Studio中设置AA时遇到了一些困难,因此留下了一个空项目供其他人使用。https://github.com/juanmendez/android-annotation-studio-demo - Juan Mendez
非常感谢,这个帮了我很多。 - harik
你可以忽略此警告,其实这是一个虚假的阳性。 - WonderCsabo
1个回答

6

@WonderCsabo已经说明这是一个误报。如果您将输出显式作为集合访问,则可以避免此警告。

androidManifestFile variant.outputs.collect()[0].processResources.manifestFile

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接