大家好,我是android开发的新手。我昨天下载了最新版本的android studio 1.3.2。但是当我开始一个新项目进行测试时,gradle给我一个错误。
我的毕业典礼是
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.niyamat.testing3"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
}
错误是
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be different than version L declared in library [com.android.support:appcompat-v7:21.0.0-rc1] C:\Users\Niyamat\Documents\Testing3\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0-rc1\AndroidManifest.xml
我知道有一些关于相同错误的问题,但我没有找到任何好的解决方案。
所以请有人帮助我吗?
最佳答案
你的 Logcat 抛出了什么
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be different than version L declared in library [com.android.support:appcompat-v7:21.0.0-rc1]
你应该怎么做
minSdkVersion
来自 的版本 list .您已经在 中声明了它build.gradle . compileSdkVersion 21
buildToolsVersion '21.1.2'
而不是你的。 compile 'com.android.support:appcompat-v7:21.0.1'
首先从您的 中删除此行 list .
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
最后
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.niyamat.testing3"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.1'
}
关于android - Gradle 构建错误 ."minsdkversion 14 cannot be different than version l declared in library"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32448927/