清单合并失败:uses-sdk:minSdkVersion 10 不能小于库 com.android.support:appcompat-v7:21.0.0-rc1 中声明的版本 L
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24436678/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version L declared in library com.android.support:appcompat-v7:21.0.0-rc1
提问by Bogdan Zurac
Got the above error after downloading L preview release version in Android Studio
, when my project had minSdkVersion
19.
在下载大号预览版发布后得到了上面的错误Android Studio
,当我的项目有minSdkVersion
19。
Furthermore, when setting mindSdkVersion
as below:
此外,当设置mindSdkVersion
如下:
defaultConfig {
....
minSdkVersion 'L'
....
}
I get dozens of errors as below, regarding resources from AppCompat-v7-21
:
关于以下资源,我收到了几十个错误AppCompat-v7-21
:
/home/user/workspace/project/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0-rc1/res/values-v21/values.xml
Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
So I have 2 questions:
所以我有两个问题:
- Why does AS complain about minSdkVersion ? I presume because AppCompat-v7 21 supports only L release; but why ? Also, will it support only L release when it is going to be officially released in autumn too ? Because that would be a problem... Or is it just a temporary restriction in order for apps not be be pushed to Play Store, as specified in the Google I/O 2014 Keynote ?
- Why does AppCompat-v7 21 complain about those errors, as I already set mindSdkVersion to L ?
- 为什么 AS 会抱怨 minSdkVersion ?我推测是因为 AppCompat-v7 21 只支持 L 版本;但为什么 ?还有,秋季正式发售的时候会不会只支持L版?因为那将是一个问题......或者它只是一个临时限制,以便不将应用程序推送到 Play 商店,如 Google I/O 2014 Keynote 所述?
- 为什么 AppCompat-v7 21 会抱怨这些错误,因为我已经将 mindSdkVersion 设置为 L ?
回答by Bogdan Zurac
compileSdkVersion 'android-L'
BOOM. Done.
繁荣。完毕。
LAST EDIT:As of Android 5.0 release, this is no longer an issue, just target API level 21 directly.
最后编辑:从 Android 5.0 版本开始,这不再是问题,只需直接针对 API 级别 21。
Edit for clarity: Indeed as David_E specified below, this solution only works for L version, if you try to deploy the app on a device below L (ex <=4.4.4) it will complain of OLD_SDK. In order for the app to work pre-L you still need to use the old v20 support lib + app compat + targetVersionSdk and compileVersionSdk
为清楚起见进行编辑:正如下面指定的 David_E,此解决方案仅适用于 L 版本,如果您尝试在低于 L(例如 <=4.4.4)的设备上部署应用程序,它会抱怨 OLD_SDK。为了使应用程序在 L 之前运行,您仍然需要使用旧的 v20 支持 lib + app compat + targetVersionSdk 和 compileVersionSdk
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
applicationId "com.example.application"
minSdkVersion 10
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
}
回答by David_E
The answer stated heremay not work properly, as it will make your app only work for Android L.
此处所述的答案可能无法正常工作,因为它会使您的应用程序仅适用于 Android L。
In order to conserve the backward compatibility with older Android OS versions, change the gradle dependecy
为了保留与旧 Android OS 版本的向后兼容性,请更改 gradle 依赖项
From:
从:
compile 'com.android.support:appcompat-v7:+'
To:
到:
compile 'com.android.support:appcompat-v7:20.+'
Note that the error complains about com.android.support:appcompat-v7:21.0.0-rc1
, the reason for that is that using appcompat-v7:+
will tell gradle to import the latest dependency of the appcompat-v7
library, unfortunately this latest version is only working for Android L, so we have to point to a previous version.
请注意,错误抱怨的是com.android.support:appcompat-v7:21.0.0-rc1
,其原因是 usingappcompat-v7:+
会告诉 gradle 导入appcompat-v7
库的最新依赖项,不幸的是,这个最新版本仅适用于 Android L,因此我们必须指向以前的版本。
Hopefully Google will fix this in the near future.
希望谷歌能在不久的将来解决这个问题。
回答by Boardy
The way that worked for me was to install the Android Studio Beta (Not Preview Release, the Beta was launched today as part of IO).
对我有用的方法是安装 Android Studio Beta(不是预览版,Beta 今天作为 IO 的一部分推出)。
Uninstall the preview release and install the Beta and open your project. It will ask you to use project SDK or Studio SDK, use Android Studio's SDK.
卸载预览版并安装 Beta 版并打开您的项目。它会要求您使用项目 SDK 或 Studio SDK,使用 Android Studio 的 SDK。
Go to your projects local.properties file and where you have sdk.dir ensure that any backslashes () are doubled up .e.g. \.
转到您的项目 local.properties 文件和 sdk.dir 所在的位置,确保任何反斜杠 () 都加倍。例如 \。
Go to Project Structure > SDK and ensure this pointing to the Android SDK on my Pc it was C:\Program Files(x86)\Android\android-studio\SDK.
转到 Project Structure > SDK 并确保它指向我 PC 上的 Android SDK,它是 C:\Program Files(x86)\Android\android-studio\SDK。
Then in your projects and any libraries you have build.gradle files where you have
然后在你的项目和任何你有 build.gradle 文件的库中
compile 'com.android.support:support-v4
Change it to
compile 'com.android.support:support-v4:20+
compile 'com.android.support:support-v4
将其更改为
compile 'com.android.support:support-v4:20+
Resync the gradle files and all fixed
重新同步gradle文件并全部修复
回答by BubbaGum
To force working with a working version Just change the gradle dependencies like this:
强制使用工作版本只需像这样更改 gradle 依赖项:
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:appcompat-v7:19+'
...
}
was:
曾是:
compile 'com.android.support:appcompat-v7:+'
N.B.
NB
I updated Tools & Extras in the SDK manager.
我在 SDK 管理器中更新了 Tools & Extras。
after the project was broken I fixed it as shown above.
项目被破坏后,我如上图所示修复了它。
For now I do not update android L & 4.4W (enough bugs for today :-( )
现在我不更新 android L 和 4.4W(今天有足够的错误:-()
回答by user3091593
Thanks David for your answer!
感谢大卫的回答!
I had to change
我不得不改变
compile 'com.android.support:support-v13:+'
To:
到:
compile 'com.android.support:support-v13:20.+'
And everything work perfect now.
现在一切都很完美。
回答by Oakenwind
Just in addition: The other answers here did not fix the problem for me, but I found an alternate way to fix the android-l problem on Android Studio 0.8.0. After I did change the dependencies in the build.gradle, the problem sadly kept occuring, that the code would say OLD_SKD. I'm using a Galaxy S2.
另外:这里的其他答案并没有为我解决问题,但我找到了一种替代方法来解决 Android Studio 0.8.0 上的 android-l 问题。在我确实更改了 build.gradle 中的依赖项后,可悲的是问题不断发生,代码会说 OLD_SKD。我正在使用 Galaxy S2。
Apart from changing allthings to :19+:
除了将所有内容更改为 :19+ 之外:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19+'
compile 'com.android.support:support-v4:19+'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:mediarouter-v7:19+'
}
It still would not work, so I had to move back everywhere possible:
它仍然不起作用,所以我不得不尽可能地搬回去:
android {
compileSdkVersion 19
buildToolsVersion '19.1'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
Now the app works again on the phone. I should probably get a new mobile, but for now, I hope this may help someone.
现在该应用程序再次在手机上运行。我可能应该买一部新手机,但就目前而言,我希望这可以帮助某人。