Android studio 中 想导入androidannotation 的配置问题。
android studio设置界面没有sources设置,已经研究好些天了,一直没有找到,也没有配置成功。请问有成功的吗?能否知道一下
android studio设置界面没有sources设置,已经研究好些天了,一直没有找到,也没有配置成功。请问有成功的吗?能否知道一下
2015-09-10
(一) Project 的 build.gradle
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
(二) Module的 build.gradle
//配置Android annotations
//配置Android annotations apply plugin:'android-apt' def AAVersion='3.3.2' dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:22.2.0' apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion" } apt { arguments { androidManifestFile variant.outputs[0]?.processResources?.manifestFile // if you have multiple outputs (when using splits), you may want to have other index than 0 // you should set your package name here if you are using different application IDs // resourcePackageName "your.package.name" // You can set optional annotation processing options here, like these commented options: // logLevel 'INFO' // logFile '/var/log/aa.log' } }
重新编译下即可。
(三) 修改AndroidManifest.xml中Activity,加上”_”
然后就可以运行了
举报