1: Download the latest version of Androidannotations-api-3.3.1.jar from GitHub
2: New Module:my-aa-test
3: Copy the Androidannotations-api-3.3.1.jar to the module Libs directory
4: Modify the contents of the Build.gradle configuration file under the project:
The following configuration items are mainly added:
' com.neenbedankt.gradle.plugins:android-apt:1.4 '
//top-level build file where can add configuration options common to all sub-projects/modules.Buildscript {repositories {jcenter ()} dependencies {Classpath'com.android.tools.build:gradle:1.0.0' //AA Configuration 1Classpath'com.neenbedankt.gradle.plugins:android-apt:1.4' //Note:do not place your application dependencies here; they belong//In the individual module build.gradle files}}allprojects {repositories {jcenter ()}}
5: Modify the contents of the Build.gradle configuration file under module My-aa-test:
Apply plugin:'com.android.application'//AA ConfigurationApply plugin:'android-apt'Android {compilesdkversion +buildtoolsversion"21.1.2"Defaultconfig {ApplicationID"com.example.y.myapplication"minsdkversion -targetsdkversion +Versioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile ('Proguard-android.txt'),'Proguard-rules.pro' } }}//AA Configurationapt {arguments {androidmanifestfile variant.outputs[0].processresources.manifestfile Resourcepackagename"com.example.y.myapplication"//App Package name}}dependencies {//AA ConfigurationApt'org.androidannotations:androidannotations:3.3.1'Compile Filetree (dir:'Libs', include: ['*.jar']) Compile'com.android.support:appcompat-v7:21.0.3'}
6: Load Androidannotations-api-3.3.1.jar in, right mouse button "Add as Library":
The following configuration items are present in the Build.gradle configuration file in the module:
Compile files ('libs/androidannotations-api-3.3.1.jar')
7: Modify Mainactivity, annotate it
@EActivity (R.layout.activity_main) Public class extends actionbaractivity {}
8: Modify the Androidmanifest.xml configuration file to change the mainactivity to Mainactivity_
<ActivityAndroid:name=". Mainactivity_ "Android:label= "@string/app_name" > <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN" /> <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> </Intent-filter> </Activity>
9: Run the test, will pop up the edit box prompt, directly click "Run" to run, continue to click "Continue anyway", waiting for gradle packaging processing, the final test pass.
AndroidStudio1.1.0 Configuration using Androidannotations