// 聲明是Android程序 apply plugin: 'com.android.application' android { signingConfigs { } compileSdkVersion 21 buildToolsVersion '25.0.0' sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') debug.setRoot('build-types/debug') release.setRoot('build-types/release') } defaultConfig { applicationId "com.wbh.hoge.crmapp" minSdkVersion 21 targetSdkVersion 21 versionCode 1 versionName "1.0" manifestPlaceholders = [UMENG_CHANNEL_VALUE: "channel_name"] } //移除lint檢查的error lintOptions { abortOnError false } buildTypes { release { // 是否進行混淆 minifyEnabled false // 混淆文件的位置 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } dependencies { // compile 'com.umeng:fb:5.4.0' compile 'com.android.support:support-v4:21.+' compile fileTree(include: '*.jar', dir: 'libs') compile 'com.jiechic.library:xUtils:2.6.14' //compile files('libs/wbh-adapter-0.0.1-SNAPSHOT.jar') compile files('libs/universal-image-loader-1.9.5.jar') } repositories { jcenter() maven { url "https://raw.githubusercontent.com/umeng/mvn-repo-umeng/master/repository" } }
這是無錯的一個配置,真是費勁,好幾天了,都不行,終於能夠了;java
gradle 這個插件,將從網上下載的文件,放到對應的文件夾下了:android
/Applications/Android Studio.app/Contents/gradle/gradle-3.3git
本來該路徑中是沒有gradle-3.3,硬加上的。不知道怎麼設置全局的,不然創建個新項目就卡住不動了。github