Created
March 21, 2015 13:57
-
-
Save kosiara/23cb3bf47b5042b931f0 to your computer and use it in GitHub Desktop.
Add Android Annotations to project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//========== 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']) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//======== 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