为了账号安全,请及时绑定邮箱和手机立即绑定

Android studio 中 想导入androidannotation 的配置问题。

android studio设置界面没有sources设置,已经研究好些天了,一直没有找到,也没有配置成功。请问有成功的吗?能否知道一下

正在回答

2 回答

(一)  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,加上”_”

然后就可以运行了

0 回复 有任何疑惑可以回复我~

http://www.cnblogs.com/caobotao/p/5138935.html

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
懒人必备之Android效率开发框架
  • 参与学习       61359    人
  • 解答问题       72    个

本教程带你学一个快捷方便的Android开发框架,敏捷开发必备

进入课程

Android studio 中 想导入androidannotation 的配置问题。

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号