Android Gradle配置

解决问题

  • 错误: Could not find the AndroidManifest.xml file, going up from path 
  • //打开app build.gradle文件加入以下代码
  • 错误:  Could not find property ‘processResources’ 1.
  • //打开全局文件 build.gradle加入以下代码

build.gradle完整源码

第一步奏,打开app moder中的 build.gradle 文件

/**
 * 常量定义
 */
def AppPackageName = "com.apkdemo.demo"; /* 包名:必须改当前包名 */
def AppSigningKey = "/Users/oscar/Desktop/TestApkKey/gradledemo.jks"; /* APK 签名key文件目录 */
def StorePassword = "123123" /* APK 签名key密码(第一重密码) */
def KeyAlias = '123321' /** APK 签名key别名 */
def KeyPassword = "123123" /* APK 签名key别名密码(第二重密码) */

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

android {
 compileSdkVersion 21
 buildToolsVersion "20.0.0"

 defaultConfig {
 applicationId AppPackageName
 minSdkVersion 15
 targetSdkVersion 21
 versionCode 1
 versionName "1.0"
 }

 compileOptions {
 sourceCompatibility JavaVersion.VERSION_1_7
 targetCompatibility JavaVersion.VERSION_1_7
 }
 buildTypes {
 release {
 minifyEnabled false
 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
 }
 }
}


/**
 * AA注解Apt配置
 */
apt {
 arguments {
 androidManifestFile variant.processResources.manifestFile
 resourcePackageName AppPackageName
 }
}

/**
 *排除
 */
android {
 packagingOptions {
 exclude 'META-INF/LICENSE.txt'
 }
}

/**
 * .so文件的导入
 */
task copyNativeLibs(type: Copy) {
 from fileTree(dir: 'libs', include: 'armeabi/*.so') into 'build/lib'
 from fileTree(dir: 'libs', include: 'armeabi-v7a/*.so') into 'build/lib'
 from fileTree(dir: 'libs', include: 'x86/*.so') into 'build/lib'
}

/**
 * 支持库
 */
dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 compile 'com.android.support:appcompat-v7:21.0.0'
 //框架系列

 apt 'org.androidannotations:androidannotations:3.2+' // AA注解库1
 compile 'org.androidannotations:androidannotations-api:3.2+' // AA注解库2

// //请求系列
// compile 'com.loopj.android:android-async-http:1.4.5+' //Android异步Http请求
// //动画系列
// compile 'com.nineoldandroids:library:2.4.0+' //Nine Old Androids 将Android 3.0(Honeycomb)所有动画API兼容到Android1.0
// //缓存系列
// compile 'com.squareup.picasso:picasso:2.3.3' //picasso图片缓存
// //控件系列
//// compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.1' //按钮上显示进度状态。(最低需要andriud版本10)
//// compile 'de.hdodenhof:circleimageview:1.1.1' //CircleImageView实现带边框圆形头像.
//// compile 'com.daimajia.numberprogressbar:library:1.1@aar' //NumberProgressBar文字进度跟随进度条展示。(最低需要andriud版本10)
//// compile 'info.hoang8f:fbutton:1.0.5' //FButton FButton的是Android与“平板UI”的概念自定义按钮。(最低需要andriud版本9)
//// compile 'pl.droidsonroids.gif:android-gif-drawable:1.0.+' //用jni实现的,
//// compile 'com.nhaarman.supertooltips:library:3.0.+' //supertooltips 带动画效果的Tips显示
//// compile 'org.holoeverywhere:slidingmenu:1.4.2+' //SlidingMenu (依赖actiomnBar)滑出式菜单,通过拖动屏幕边缘滑出菜单.
// //工具系列
// compile 'com.alibaba:fastjson:+' //fastjson 目前比较快的json解析库
}

  第二步奏,打开项目空间全局文件 build.gradle 复制以下

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


 }
}
allprojects {
 repositories {
 mavenCentral()
 }
}

  

原文地址:https://www.cnblogs.com/spring87/p/4525227.html