我正在使用带有AA的Android studio 0.4.2(Gradle项目)
我的gradle.build如下所示
apply plugin: 'android'
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
......
dependencies {
compile 'com.android.support:support-v4:19.0.0+'
compile 'com.android.support:appcompat-v7:19.0.0+'
compile 'com.googlecode.androidannotations:androidannotations-api:2.7.1'
compile 'com.googlecode.androidannotations:androidannotations:2.7.1'
compile fileTree(dir: 'libs', include: '*.jar')
}
android.applicationVariants.each { variant ->
println 'Generation dir: ' + annotationDirs
variant.javaCompile.dependsOn annotationsDir
variant.javaCompile.options.compilerArgs += [
'-processor', 'com.googlecode.androidannotations.AndroidAnnotationProcessor',
'-s', annotationDirs
]
}
在我的项目中,我只使用像replaceFragment(new RegistrationFragment_());
这样的基于java的类,这是使用带注释的类的正确方法,当我运行build
任务时它运行良好,但IDE显示错误 - '无法解析SymbolFragment_'符号。所有gen _.java文件都存储在PROJECT_NAME\app\build\classes\debug\com\witness\app\RegistrationFragment_.java
中。我该如何解决这个问题?