Jac*_*ień 5 android gradle android-studio
我正在使用Android Studio 0.4.5并且无法同步gradle.
当我尝试这样做时,我收到此错误:
Gradle 'MyApp' project refresh failed: Build script error, unsupported Gradle DSL method found: 'android()'!
Run Code Online (Sandbox Code Playgroud)
我的解决方案包含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()
}
}
Run Code Online (Sandbox Code Playgroud)
和其他人(为简单起见,我删除了依赖项)
第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'
}
}
}
Run Code Online (Sandbox Code Playgroud)
第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'
}
}
Run Code Online (Sandbox Code Playgroud)
模块3 应用插件:'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'
}
}
Run Code Online (Sandbox Code Playgroud)
第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'
}
}
Run Code Online (Sandbox Code Playgroud)
很抱歉让这么久,但我在这里绝望了:(
主要原因是:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
Run Code Online (Sandbox Code Playgroud)
在根build.gradle中.
| 归档时间: |
|
| 查看次数: |
11671 次 |
| 最近记录: |