標籤:
解決問題
- 錯誤: Could not find the AndroidManifest.xml file, going up from path
- //開啟app
build.gradle檔案加入以下代碼
/*** AA註解Apt配置*/apt { arguments { androidManifestFile variant.processResources.manifestFile resourcePackageName AppPackageName }}
- 錯誤: Could not find property ‘processResources’ 1.
- //開啟通用檔案
build.gradle加入以下代碼
classpath ‘com.android.tools.build:gradle:1.0.0-rc1‘ //替換 classpath ‘com.android.tools.build:gradle:0.14.2‘
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:[email protected]‘ //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() }}
Android Gradle配置