将
androidannotations-3.2.jar 复制到APP下compile-libs (不存在这个文件,自己创建)
第一步 将androidannotations-api-3.2.jar 复制到APP下的libs
--------------------------------------
第二步 全局build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// 设置脚本的运行环境
buildscript {
/**
* 支持java 依赖库管理(maven/ivy),用于项目的依赖
* */
repositories {
jcenter()
}
/** 依赖包的定义。
* 支持maven/ivy,远程,本地库,也支持单文件,
* 如果前面定义了repositories{}maven 库,
* 使用maven的依赖(我没接触过ivy。。)的时候只需要按照用类似于com.android.tools.build:gradle:0.4,
* gradle 就会自动的往远程库下载相应的依赖。
* */
dependencies {
classpath "com.android.tools.build:gradle:1.0.0"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
jcenter()
}
}
---------------------------
第三步 App 下面的
build.gradle
apply plugin: 'android'
apply plugin: 'android-apt'
def AndroidAnnotationVersion = '3.2'
def AppPackageName = "com.xxx.yyy"
def AppVersionCode = 1
def AppVersionName = "1.0.0"
/**
* 设置编译android项目的参数
*/
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.hequ.merchant"
minSdkVersion 14
targetSdkVersion 21
versionName AppVersionName
signingConfig signingConfigs.hequ
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations {
apt
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//AndroidAnnotation
apt files('compile-libs/androidannotations-3.2.jar')
//apt "org.androidannotations:androidannotations:$AndroidAnnotationVersion"
//compile "org.androidannotations:androidannotations-api:$AndroidAnnotationVersion"
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile project(':imeth')
}
apt {
arguments {
androidManifestFile variant.<span style="background-color: rgb(255, 102, 102);">outputs[0]</span>.processResources.manifestFile
resourcePackageName AppPackageName
}
}
注意 红色区 网上很多教程都不是这样的..
----------------------------
第四步, 编译一下就都Ok了
有什么问题可以QQ(765858000)