android - AndroidAnnotations Nothing Generated, Empty Activity -


i trying create project using androidannotations in android studio. when build , run project, seems compile fine, yet nothing blank activity app. in addition, not appear generated androidannotations.

i have added androidannotations-api-2.7.1.jar dependency project, , enabled annotation processing processor path path androidannotations-2.7.1.jar, in separate folder androidannotations-api-2.7.1.jar. have checked store generated sources relative module content root, , tried many different directories sources -- generated, gen/aa, (currently) build/source/aa match seems generated files created in android studio. nothing has worked. have changed activity name in manifest activity_, , set configuration launch when project run.

the other dependencies have android-support-v4 , actionbarsherlock. have tried both of these disabled, no result. planned use roboguice in conjunction androidannotations, have disabled time being try focus on issue.

i using, or trying use, gradle. build.gradle:

buildscript {   repositories {     maven { url 'http://repo1.maven.org/maven2' }   }   dependencies {     classpath 'com.android.tools.build:gradle:0.4'   } }  apply plugin: 'android'  dependencies {   compile files('libs/android-support-v4.jar')   compile files('libs/actionbarsherlock-4.3.1.jar')   compile files('libs/androidannotations-api-2.7.1.jar') }  android {   compilesdkversion 17   buildtoolsversion "17.0.0"    defaultconfig {     minsdkversion 7     targetsdkversion 17   } } 

however, haven't figured out how gradle works, manually added dependencies normal project, put compile lines in gradle project compile properly. know not correct way use it.

my activity , layout standard, copied them official guide started androidannotations.

update: went maven test build that, , noticed strange. seems how have set in maven, nothing generated. however, maven build can run project without changing activity name in manifest activity_ , project compile , run correctly. odd , seems either further confuse problem, or simplify if indicative of gradle well.

this similar robotoaster's response, works in 0.4.1 , places generated java source files in new directory (consistent other generated source folders), allows android studio see source , stop complaining. works more annotation processors. add annotation processors "apt" configuration.

buildscript {     repositories {         mavencentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:0.4.1'     } } apply plugin: 'android'  repositories {     mavencentral() }  ext.daggerversion = '1.0.0'; ext.androidannotationsversion = '2.7.1';  configurations {     apt }  dependencies {     apt "com.googlecode.androidannotations:androidannotations:${androidannotationsversion}"     compile "com.googlecode.androidannotations:androidannotations-api:${androidannotationsversion}"     apt "com.squareup.dagger:dagger-compiler:${daggerversion}"     compile "com.squareup.dagger:dagger:${daggerversion}" }  android {     compilesdkversion 17     buildtoolsversion "17.0.0"      defaultconfig {         minsdkversion 10         targetsdkversion 17     } }  android.applicationvariants.all { variant ->     aptoutput = file("${project.builddir}/source/apt_generated/${variant.dirname}")     println "****************************"     println "variant: ${variant.name}"     println "manifest:  ${variant.processresources.manifestfile}"     println "aptoutput:  ${aptoutput}"     println "****************************"      variant.javacompile.dofirst {         println "*** compile dofirst ${variant.name}"         aptoutput.mkdirs()         variant.javacompile.options.compilerargs += [                 '-processorpath', configurations.apt.getaspath(),                 '-aandroidmanifestfile=' + variant.processresources.manifestfile,                 '-s', aptoutput         ]     } } 

update: still works compile, android studio 0.1.1 can no longer edit project structure ui, can't tell @ new source folder. i'd add folder sourceset, variants don't seem have own sourcesets i'm not sure yet put it.

update 2: can android studio 0.1.1 recognize apt-generated source files right-clicking on build/source/apt_generated/debug in project browser , selecting mark directory as->source root

update 3: since gradle plugin 0.5.5 android.applicationvariants.each not work anymore. use android.applicationvariants.all instead. see changelog @ android.com: access variants container don't force creating task. means android.[application|library|test]variants empty during evaluation phase. use it, use .all instead of .each


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -