Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Android Annotations to project
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.your.application.id">
<application
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<activity
//change Activity class to generated class from AA
android:name="com.your.application.id.activity.SampleActivity_"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
</application>
</manifest>
//========== app build.gradle ===================
apply plugin: 'com.android.application'
//apply android-apt plugin
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.your.application.id"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
//add apt arguments, note: gradle version 1.0+
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
dependencies {
//add these 2 lines
compile "org.androidannotations:androidannotations-api:3.2"
apt "org.androidannotations:androidannotations:3.2"
compile fileTree(dir: 'libs', include: ['*.jar'])
}
//======== Top level build.gradle ==============
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
//add this line
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
jcenter()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.