由网友(怕冷却爱上雪怕伤却爱上你)分享简介:我使用的是Android 0.4.5工作室,并有麻烦同步摇篮。I'm using Android Studio 0.4.5 and having troubles syncing gradle.当我尝试这样做,我得到这个错误:When I try to do that I get this error:Grad...
我使用的是Android 0.4.5工作室,并有麻烦同步摇篮。
I'm using Android Studio 0.4.5 and having troubles syncing gradle.
当我尝试这样做,我得到这个错误:
When I try to do that I get this error:
Gradle 'MyApp' project refresh failed: Build script error, unsupported Gradle DSL method found: 'android()'!
我的解决方案包含4个模块。这里是我的根 build.graddle
:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
allprojects {
repositories {
mavenCentral()
}
}
和其他人(我删除的依赖为简单起见)
And the others (I removed dependencies for simplicity)
模块1
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
模块2
apply plugin: 'android-library'
android {
compileSdkVersion 18
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
模块3 应用插件:机器人库
Module 3 apply plugin: 'android-library'
android {
compileSdkVersion 18
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
模块4
apply plugin: 'android-library'
android {
compileSdkVersion 17
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
对不起,让这个这么久,但我越来越绝望这里:(
Sorry for making this so long, but I'm getting desperate here :(
推荐答案
主要的原因是有这样的:
The main reason was having this:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
在根build.gradle
in the root build.gradle.
相关推荐
最新文章