android - 使用 Android Studio(测试版)0.8.4 配置 Android Annotations v3.0.1

标签 android android-studio android-gradle-plugin android-annotations

配置 Android 注释非常麻烦。但我终于想出了一个解决办法,想和大家分享一下。

最佳答案

Use the below mentioned gradle buildscript.
Following are some of the references:
1) https://github.com/excilys/androidannotations/blob/develop/examples/gradle/build.gradle
2) https://bitbucket.org/hvisser/android-apt
3) http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/

build.gradle

 buildscript {
      repositories {
      mavenCentral()
 }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.12.1'
          classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
      }
 }

 apply plugin: 'com.android.application'
 apply plugin: 'com.neenbedankt.android-apt'


 repositories {
     mavenCentral()
 }

 ext.androidAnnotationsVersion = '3.0.1';

 configurations {
    apt
 }

 android {
     compileSdkVersion 19
     buildToolsVersion "19.1.0"
     useOldManifestMerger true

     defaultConfig {
         minSdkVersion 14
         targetSdkVersion 19
         versionCode 1
         versionName "1.0"
     }



     buildTypes {
         release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
         }
     }

     packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
     }
}

dependencies {
    compile 'com.android.support:support-v4:20.0.+'
    compile 'com.android.support:appcompat-v7:20.0.+'
    apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
    compile "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
    compile fileTree(dir: 'libs', include: '*.jar')

} 


apt {
    arguments {
        resourcePackageName 'com.yourpackage.name'
        androidManifestFile variant.processResources.manifestFile
    }
}

关于android - 使用 Android Studio(测试版)0.8.4 配置 Android Annotations v3.0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25441370/

相关文章:

android-studio - 在 Android Studio 中检查元素

android - 远程aar在Android Studio中是如何工作的

Gradle、Android、Jacoco 和 JUnit5

android - 使用 Gradle 编译时出错(找不到下载的依赖项)

android - 是否可以取消所有具有特定标签的通知?

javascript - 我们如何在 Javascript 中捕获移动设备 "Next"按钮按键

java - 使用自定义图标时增加导航底部 View android中选定图标的高度?

android - gradle文件夹之间的关联

java - 缺少库或代码不正确? Android Studio,APK 崩溃

android - Gradle 插件 'com.android.library' 不在自定义 Maven 存储库中搜索