There is a sample Gradle build file for a project with Android Annotations. This is pretty complicated stuff, that was achieved with a lot of my blood, so I decided to post it here, so that you can use it to try to find your mistakes. Android Annotations library is loaded with apt. The position of every setting is important. There is also a trick to avoid Lint errors and a custom task to run app via command line.
I used Gradle 1.12 and Android Studio 0.8.4 with Android SDK 20, Android Build Tools 20.0 and Android Plugin 0.12.+.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' } } repositories { mavenCentral() mavenLocal() } apply plugin: 'com.android.application' apply plugin: 'android-apt' def AAVersion = '3.0.1' dependencies { apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion" compile "com.android.support:support-v4:18.0.+" compile "com.android.support:appcompat-v7:18.0.+" compile 'org.apache.commons:commons-lang3:3.0.+' compile fileTree(dir: 'libs', include: '*.jar') } apt { arguments { androidManifestFile variant.processResources.manifestFile resourcePackageName "ru.rabota.app2" } } android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { minSdkVersion 10 targetSdkVersion 20 versionCode 17 versionName "2.4.2" } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } androidTest.setRoot('tests') } lintOptions { abortOnError false } } task appStart(type: Exec, dependsOn: ':installDebug') { // linux commandLine 'adb', 'shell', 'am', 'start', '-n', 'ru.rabota.app2/ru.rabota.intro.IntroActivity' // windows // commandLine 'cmd', '/c', 'adb', 'shell', 'am', 'start', '-n', 'com.alwawee.multiverse/com.alwawee.main.MainActivity' } |