Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this is an update to the answer that does the following things:</p> <ul> <li>works with Android Studio 0.1.9</li> <li>removes syntax errors from IDE (even on rebuilds)</li> <li>uses androidannotations without dagger</li> </ul> <p>In order to achieve this I copy the output to build/source/r witch will remain marked as source during rebuilds.</p> <pre><code>import groovy.io.FileType buildscript { } apply plugin: 'android' repositories { mavenCentral() } ext.androidAnnotationsVersion = '2.7.1'; configurations { apt } dependencies { apt "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}" compile "com.googlecode.androidannotations:androidannotations-api:${androidAnnotationsVersion}" } android { compileSdkVersion 17 buildToolsVersion "17.0.0" defaultConfig { minSdkVersion 10 targetSdkVersion 16 } } android.applicationVariants.each { variant -&gt; aptOutput = file("${project.buildDir}/source/r/${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() aptOutput.eachFileRecurse FileType.FILES, { if (it.name.equals('R.java')) { return } it.delete() } variant.javaCompile.options.compilerArgs += [ '-processorpath', configurations.apt.getAsPath(), '-AandroidManifestFile=' + variant.processResources.manifestFile, '-s', aptOutput ] } } </code></pre> <p>Still pretty hacky improvement suggestions are welcomed</p> <p><strong>EDIT</strong> the android-apt way</p> <p>Recently a package called <em>android-apt</em> <a href="https://bitbucket.org/hvisser/android-apt/overview" rel="nofollow">https://bitbucket.org/hvisser/android-apt/overview</a> was release that makes things a lot easier (version 1.1 has the support android annotations needs)</p> <p>Simply update your build.gradle like so:</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath "com.neenbedankt.gradle.plugins:android-apt:1.1" } } apply plugin: 'android-apt' apt { arguments { androidManifestFile variant.processResources.manifestFile } } dependencies { apt 'com.googlecode.androidannotations:androidannotations:2.7.+' } </code></pre> <p>A big thank you goes to hvisser the creator of android-apt</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload