Getting Android Studio, Gradle, and Android annotations working together

Now that I decided to use Android annotations with Android Studio, I wanted to implement it through Gradle. After some thoughtful research, I found out that there are older and newer ways to implement Android annotations through Gradle, depending on which version of android studio, Gradle or android annotations. I came to this useful tutorial β†’ http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/ and tried to implement this, at first, with the new β€œandroid-L” as the target SDK for example

targetSDKversion "android-L" + compileSdkVersion 20 + buildToolsVersion "20.0.0"

until i tried it with

targetSDKversion 20 + compileSdkVersion 20 + buildToolsVersion "20.0.0"

and

targetSDKversion 19 + compileSdkVersion 19 + buildToolsVersion "19.1.0".

Every time I received 2 warnings, my java classes didn't seem to be precompiled. although it seems like it pre-creates the build / generated / source / apt directory. but without my pre-processed class from my MainActivity -> MainActivity _

I always get the following warnings:

Note. Allow the log file in D: \ AndroidProjects \ GradleTest \ app \ build \ generated \ source \ apt \ androidannotations.log. Note. Initialize AndroidAnnotations 3.0.1 using the options> {androidManifestFile = D: \ AndroidProjects \ GradleTest \ app \ build \ intermediates \ manifestests \ debug \ AndroidManifest.xml, resourcePackageName = at.gradle.defuex.gradletest}

warning: unblocked files for types "[dummy1407928544078]"; these types will not be processed annotations

warning: The following parameters were not recognized by any processor: '[androidManifestFile, resourcePackageName]'

My build.gradle file is as follows:

buildscript{ repositories{ mavenCentral() } dependencies{ classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3' } } repositories{ mavenCentral() } apply plugin: 'com.android.application' apply plugin: 'android-apt' android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId "at.gradle.defuex.gradletest" minSdkVersion 10 targetSdkVersion 19 versionCode 1 versionName "1.0" } signingConfigs{ releaseConfig{ storeFile file("gradlekeystore.jks"); storePassword ("*************"); keyAlias "keyAlias"; keyPassword "*************"; } } buildTypes { release { runProguard false debuggable false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.releaseConfig } debug { debuggable true applicationIdSuffix ".debug" } } } apt { arguments { androidManifestFile variant.processResources.manifestFile resourcePackageName "at.gradle.defuex.gradletest" } } dependencies { apt "org.androidannotations:androidannotations:3.0+" compile "org.androidannotations:androidannotations-api:3.0+" compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:19.+' } 

Im using the following versions:

  • Android Studio version 0.8.2
  • Gradle version 0.12.2
  • version for Android version 1.3
  • annotations of android version 3.0.1 (as seen from the build.gradle file)
  • If you need to solve this problem, please tell me, because I am confused now.
  • If there should be a better annotation structure or a way to use great annotations, please let me know.
  • And if in any case you no longer need to use annotations for Android projects, please let me know.

but I would prefer a solution to my problem :)

Hooray!

+7
android android-studio android-gradle gradle android-annotations
source share
1 answer

Try to run gralew clean build from the project root. Then, before starting on the device, try to make a project (button with a green arrow from 0 and 1). It should be good.

-one
source share

All Articles