参考github上的demo,新建一个project后,会有一个位于app文件夹下的局部build.gradle文件和一个位于根目录project下的全局build.gradle文件,我们要修改的是局部gradle文件:

 1 buildscript { 2     repositories { 3         mavenCentral() 4     } 5     dependencies { 6         // replace with the current version of the Android plugin 7         classpath 'com.android.tools.build:gradle:1.0.0' 8         // the latest version of the android-apt plugin 9         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'10     }11 }12 13 repositories {14     mavenCentral()15     mavenLocal()16 }17 18 apply plugin: 'com.android.application'19 apply plugin: 'android-apt'20 def AAVersion = '3.3-SNAPSHOT' // change this to your desired version, for example the latest stable: 3.221 22 dependencies {23     apt "org.androidannotations:androidannotations:$AAVersion"24     compile "org.androidannotations:androidannotations-api:$AAVersion"25 }26 27 apt {28     arguments {29         androidManifestFile variant.outputs[0].processResources.manifestFile30         // if you have multiple outputs (when using splits), you may want to have other index than 031         32         resourcePackageName 'org.androidannotations.gradle'33 34         // If you're using Android NBS flavors you should use the following line instead of hard-coded packageName35         // resourcePackageName android.defaultConfig.packageName36 37         // You can set optional annotation processing options here, like these commented options:38         // logLevel 'INFO'39         // logFile '/var/log/aa.log'40     }41 }42 43 android {44     compileSdkVersion 1945     buildToolsVersion "21.1.1"46 47     defaultConfig {48         minSdkVersion 949         targetSdkVersion 1950     }51 }


最后再在AndroidManifest.xml中的Activity的名字后面加上 _(下划线)

然后编译项目 完成! 如果报错,请多编译几次。编译按钮:

我的顺利编译通过。 参考博客:http://blog.csdn.net/ljphhj/article/details/37601173

更多相关文章

  1. Android多个React-Native模块的实现及源码解读
  2. android之动态新建txt文件与读取
  3. android学习记录2(日志、上下文、android下数据存储、xml基础)
  4. android mk file 描述
  5. android studio导出apk步骤
  6. Android(安卓)Bugly 热修复 快速接入
  7. 新浪微博2.5.1 for Android(安卓)去广告
  8. Android-telephony各文件解释
  9. --Android引用so文件引发的血案

随机推荐

  1. View篇之View的滑动
  2. 多态在android中(利用接口调用服务中方法)
  3. Android为什么使用Binder-android学习之
  4. android provider 基础介绍
  5. GPS定位与高德地图的使用
  6. Qt for Android调用Android接口将程序移
  7. Android 基于FFmpeg的视频播放渲染 CMake
  8. Android 自定义View 仿蚂蚁信用分析(正多
  9. Android App 反应卡顿解决方案
  10. 自定义HID设备与Android设备通信