3

Im using Android studio 0.4.2 (Gradle project) with AA

My gradle.build looks like below

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
    ]
}

in my project I just use genereted java class like replaceFragment(new RegistrationFragment_()); , this is a correct way to use annotated class and it works well when I run build task, but IDE shows me an error - 'cannot resolve symbol RegistrationFragment_'. All gen _.java files are stored in PROJECT_NAME\app\build\classes\debug\com\witness\app\RegistrationFragment_.java. How can I fix this?

Gorets
  • 2,434
  • 5
  • 27
  • 45
  • possible duplicate of [Android Studio 0.4.2 suddenly cannot resolve symbols](http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols) – Scott Barta Jan 16 '14 at 00:06
  • no, it was last one that I red and tried before write my question – Gorets Jan 16 '14 at 00:13
  • Okay, retracted the close vote. – Scott Barta Jan 16 '14 at 00:16
  • i think the problem can be in sourceSets config, maybe this parameter java.srcDirs = ['src'] set up only one srcDir and IDE cannot find other genereted classes in build folder, but I have not any ideas how to solve it. – Gorets Jan 16 '14 at 00:22
  • 2
    Take a look to this plugin https://bitbucket.org/hvisser/android-apt – Eugen Martynov Jan 16 '14 at 12:18

0 Answers0