Android Annotations in Android Studio 0.8.9

I'm new to Android Studio and gradle, so I'm not sure how to properly set up my project to use android annotations.

I followed this tutorial and ended up with this build.gradle file:

buildscript {
   repositories {
      mavenCentral()
   }
   dependencies {
      classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4+'
   }
}

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
   compileSdkVersion 20
   buildToolsVersion '20.0.0'

   defaultConfig {
      applicationId "com.example.test"
      minSdkVersion 11
      targetSdkVersion 20
      versionCode 1
      versionName "1.0"
   }
   buildTypes {
      release {
         runProguard false
         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
   }
}

configurations {
   apt
}

apt {
   arguments {
      androidManifestFile variant.processResources.manifestFile
      resourcePackageName "com.example.test"
   }
}

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   apt "org.androidannotations:androidannotations:3.0+"
   compile "org.androidannotations:androidannotations-api:3.0+"
   compile 'com.android.support:appcompat-v7:20.0.0'
}

      

The .idea / compiler.xml file has also changed to enable annotation processing

<profile default="true" name="Default" enabled="true">

      

Gradle syncs successfully, however no file is generated. I can create an application, but when I try to add an underline to the AndroidManifest.xml file, it gives me this error:

Cannot resolve symbol 'MainActivity_'

What am I doing wrong?

+3


source to share





All Articles