热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Manifest合并失败:uses-sdk:minSdkVersion14。-Manifestmergerfailed:uses-sdk:minSdkVersion14

SincedownloadingthelatestSDKandinstallingAndroidStudio,myprojectfailstobuild.Igetthe

Since downloading the latest SDK and installing Android Studio, my project fails to build. I get the following message:

自从下载了最新的SDK并安装了Android Studio之后,我的项目就失败了。我得到以下信息:

Error:Gradle: Execution failed for task ':SampleProject:processProdDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

23 个解决方案

#1


310  

Note: This has been updated to reflect the release of API 21, Lollipop. Be sure to download the latest SDK.

注意:这已经更新,以反映API 21的发布,Lollipop。一定要下载最新的SDK。

In one of my modules I had the following in build.gradle:

在我的一个模块中,我在build.gradle中有以下内容:

dependencies {
    compile 'com.android.support:support-v4:+'
}

Changing this to

改变这

dependencies {
    // do not use dynamic updating.
    compile 'com.android.support:support-v4:21.0.0' 
}

fixed the issue.

固定的问题。

Make sure you're not doing a general inclusion of com.android.support:support-v4:+ or any other support libraries (v7, v13, appcompat, etc), anywhere in your project.

确保你没有做一个通用的。android。支持:supportv4:+或任何其他支持库(v7、v13、appcompat等),在项目的任何地方。

I'd assume the problem is v4:+ picks up the release candidate (21.0.0-rc1) latest L release which obviously requires the L SDK.

我假设问题是v4:+选择发布候选版本(21.0 -rc1),这显然需要L SDK。

Edit:

编辑:

If you need to use the new views (CardView, RecyclerView, and Palette), the following should work:

如果您需要使用新的视图(CardView、clerview和Palette),那么下面应该工作:

compile "com.android.support:cardview-v7:21.0.0"
compile "com.android.support:recyclerview-v7:21.0.0"
compile "com.android.support:palette-v7:21.0.0"

(Credit to EddieRingle on /androiddev - http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_v21_support_libs_on_older_versions/)

(Credit to EddieRingle on /androiddev - http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_support_libs_on_older_versions/)

Another Edit

另一个编辑

Be sure to see @murtuza's answer below regarding appcompat-v7 and upvote if it helps!

一定要看到@murtuza关于appcompat-v7和upvote的答案,如果它有帮助的话!

#2


69  

Also, in case you are importing the appcompat-v7 library make sure you tag a version number at the end of it like so:

另外,如果您正在导入appcompat-v7库,请确保在其末尾标记一个版本号:

compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:appcompat-v7:19.+'

After only changing the support-v4 version, I still received the error:

在仅仅更改了support-v4版本之后,我仍然收到了错误:

Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1

Manifest合并失败:us -sdk:minSdkVersion 15不能小于在library com.android.support中声明的版本L。

It was a bit confusing because it looks like v4 is still the problem, but, in fact, restricting the appcompat v7 version fixed the problem.

这有点令人困惑,因为看起来v4仍然是问题,但实际上,限制appcompat v7版本解决了这个问题。

#3


54  

Solution 1:

解决方案1:

Change uses-sdk to and add xmlns:tools="http://schemas.android.com/tools" in AndroidManifest.xml

将uses-sdk更改为 ,并在AndroidManifest.xml中添加xmlns:tools="http://schemas.android.com/tools"。

 

    .
    .
    
    .
    .

Make sure you use gradle 0.11 and above to use Manifest merger.

请确保您使用的是0.11和以上,以使用清单合并。

Solution 2:

解决方案2:

  • Change compile 'com.android.support:support-v4:+' to compile 'com.android.support:support-v4:20.+' in build.gradle. This will prevent gradle from using v4:21.0.0 that requires version L.

    改变编译的com.android。支持:support-v4:+“编译”com.android.support:support-v4:20。在build.gradle +”。这将防止gradle使用需要版本L的v4:21.0.0。

  • However, if your any of your external dependencies uses the same. You will probably have to wait for them to update the same.

    但是,如果您的任何外部依赖项使用相同的方法。您可能需要等待它们更新相同的内容。

Solution 3:

解决方案3:

  • Remove/Comment 21.0.0-rc1 in your file /extras/android/m2repository/com/android/support-v4/maven-metadata.xml

    在你的文件中,删除/评论<> .0.0 .0-rc1, /extras/android/m2repository/ m2repository/ supportv4/maven-metadata.xml。

  • Repeat the same for support-v7

    对supportv7重复同样的操作。

#4


20  


no longer works.

不再有效。

Change uses-sdk to

改变uses-sdk


and add xmlns:tools="http://schemas.android.com/tools" in AndroidManifest.xml

并在AndroidManifest.xml中添加xmlns:tools="http://schemas.android.com/tools"。

#5


11  

The problem still arises with transitive dependencies. Gradle offers a way to force the usage of a specific version of a dependency.

问题仍然出现在传递依赖关系中。Gradle提供了一种强制使用特定版本依赖的方法。

For example you can add something like:

例如,您可以添加如下内容:

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:20.+'
        force 'com.android.support:appcompat-v7:20.+'
    }
}

to your build.gradle.

build.gradle。

If you want to learn more about gradle resolution strategies refer to this guide http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

如果你想了解更多关于渐变的策略,请参考下面的指南:http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.resolution .html。

I found this while reading the corresponding issue which I will link here

我在阅读相关的问题时发现了这个问题。

#6


8  

In the build.gradle file, It was by default compile 'com.android.support:support-v4:+' so when you build the gradle projecit would consider, com.android.support:support-v4:21.0.0-rc1 because of the recent L developer preview release.

在构建。gradle文件,它是默认编译'com.android。支持:supportv4:+'所以当你构建一个gradle项目时,com.android.support:support-v4:21.0 -rc1,因为最近的L开发者预览版。

Make changes in the following line and it will resolve the issue. Change

在下面一行进行更改,它将解决这个问题。改变

compile 'com.android.support:support-v4:+' 

to

compile 'com.android.support:support-v4:20.+'

Similarly when using v7-appcompat support library, make the change from

类似地,当使用v7-appcompat支持库时,也要进行更改。

compile 'com.android.support:appcompat-v7:+'

编译的com.android.support:appcompat-v7:+

to

compile 'com.android.support:appcompat-v7:20.+'.

#7


8  

Adding to the correct answers above, the problem still might occur due to library nesting. In this case, try as the example below:

在上面添加正确的答案后,由于库嵌套,仍然可能出现问题。在这种情况下,尝试如下面的例子:

compile 'com.android.support:support-v4:20.+'
compile ('com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+') { // example
    exclude group: 'com.android.support', module:'support-v4'
    exclude group: 'com.android.support', module:'appcompat-v7'
}

#8


6  

I also had the same issue and changing following helped me:

我也有同样的问题和变化,帮助我:

from:

来自:

dependencies {
    compile 'com.android.support:support-v4:+'

to:

:

dependencies {
 compile 'com.android.support:support-v4:20.0.0'
}

#9


6  

for people building hybrid apps using cordova CLI, this command will help:

对于使用cordova CLI构建混合应用程序的人来说,这个命令将会有所帮助:

cordova build android -- --minSdkVersion=15

yes it uses double double dashes as you saw it.

是的,它使用的是双双破折号。

#10


6  

For people facing this issue in the Android Studio beta, the accepted answer didn't solve my problem. Importing a project downloaded from GitHub, I had the following in my build.gradle file of app giving an error in question:

对于在Android Studio beta中面临这个问题的人来说,接受的答案并不能解决我的问题。导入从GitHub下载的项目,我在构建中有如下内容。应用程序的gradle文件给出了一个错误:

 dependencies {
    compile 'com.android.support:support-v4:+'
}

But in my external library folder I have this folder:

但是在我的外部库文件夹中,我有这个文件夹:

support-v4-21.0.0-rc1 //note the 21

I solved the above problem by changing the dependency to:

我通过改变依赖关系来解决上述问题:

dependencies {
compile 'com.android.support:support-v4:20.+' //20 used less than available strange but works
}

Note: you might also need to download api level lower than the currently available in Android Studio for some library and projects for this to work properly.

注意:您可能还需要下载api级别低于目前在Android Studio中提供的一些库和项目,以使其正常工作。

#11


5  

I solved the problem by editing the line below in build.gradle and it works! :-)

我通过编辑下面的代码来解决这个问题。它和它的工作原理!:-)

adding version 20.+'

添加版本20。+ '

From

 dependencies {
        compile 'com.android.support:appcompat-v7:+'
    }

To

dependencies {
    compile 'com.android.support:appcompat-v7:20.+'
}

#12


4  

You have to configure all the supports and appcompat libraries with version 19.+

您必须配置所有支持和appcompat库与版本19.+。

If the recommendation of leave the support library with the 19.+ version doesn't works you can try the next tip in your AndroidManifest file.

如果推荐离开支持库与19。+版本没有效果,你可以在AndroidManifest文件中尝试下一个提示。

First add this code:

第一次添加此代码:

xmlns:tools="http://schemas.android.com/tools"

And then, at the application level (not inside application!)

然后,在应用程序级别(不在应用程序内!)


#13


4  

I make all of the solutions in here with no result, so i look in another place and i found a way to trick the IDE, so you have to put a line in the Mainfest to make the Gradle use a different one, the one that you put on build.gradle the line is:

我让所有的解决方案在这里没有结果,所以我在另一个地方看,我发现了一个方法技巧IDE,所以你必须把线放在Mainfest Gradle使用一个不同的人,你戴上构建。gradle线路是:


just it, and it work.

就是这样,而且还有效。

I hope it helps.

我希望它有帮助。

#14


4  

compile('com.android.support:support-v4:19.1.0'){
    force = true
}

Helped me, taken from here

帮助我,从这里带走。

#15


3  

You need to remove from build.gradle compile 'com.android.support:support-v13:+'

您需要从构建中移除。gradle编译的com.android.support:support-v13:+

#16


3  

Here's the new bug filed for this btw https://code.google.com/p/android/issues/detail?id=72430

这里有一个新的bug,它是针对这个btw的https://code.google.com/p/android/addrees/detail? id=72430。

Assuming you are using the Support Repository, the workaround is to comment or remove the line

假设您正在使用支持存储库,那么解决方案是注释或删除该行。

21.0.0-rc1 in the local Maven repo listing file at /extras/android/m2repository/com/android/support-v4/maven-metadata.xml

在本地的Maven repo列表文件中,在/extras/android/m2repository/ support-v4/maven-metadata.xml中。

#17


0  

Don't forget, you should edit build.gradle in 'app' subfolder of your project, not in project's folder. I've lost a working day trying to solve a problem with version "L".

别忘了,你应该编辑build。在你的项目的“应用程序”的子文件夹中,而不是在项目的文件夹中。我已经失去了一个工作日,试图解决一个版本“L”的问题。

#18


0  

Try deleting the build folder(s) in your project and resync your gradle project to rebuild it. Also, like others have said in this post - instead of doing something like this:

尝试删除项目中的构建文件夹,并重新同步您的gradle项目来重新构建它。而且,就像其他人在这篇文章中所说的那样:

compile 'com.android.support:support-v4:19.+'

do this:

这样做:

compile 'com.android.support:support-v4:19.1.0'

#19


0  

Thank you @Murtuza. Your answer helped me to solve my problem but in my case

谢谢你@Murtuza。你的回答帮助我解决了问题,但在我的情况下。

compile 'com.android.support:support-v13:19.+ also, along with

编译的com.android.support:support-v13:19。+,连同

compile 'com.android.support:support-v4:19.+' compile 'com.android.support:appcompat-v7:19.+'

编译的com.android.support:support-v4:19。+“编译”com.android.support:appcompat-v7:19。+ '

from compile 'com.android.support:support-v4:+' compile 'com.android.support:support-v7:+' compile 'com.android.support:support-v13:+' Hope this might help some one

从编译的com.android。支持:support-v4:+ com.android“编译”。支持:support-v7:+ com.android“编译”。支持:supportv13:+“希望这能帮助一些人。”

#20


0  

I have some projects where I prefer to target L.MR1(SDKv22) and some projects where I prefer KK(SDKv19). Your result may be different, but this worked for me.

我有一些项目,我更喜欢使用lmr1 (SDKv22)和一些我喜欢KK(SDKv19)的项目。你的结果可能不一样,但这对我很有效。

// Targeting L.MR1 (Android 5.1), SDK 22
android {
    compileSdkVersion 22
    buildToolsVersion "22"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 22
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // google support libraries (22)
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:cardview-v7:21.0.3'
    compile 'com.android.support:recyclerview-v7:21.0.3'
}



// Targeting KK (Android 4.4.x), SDK 19
android {
    compileSdkVersion 19
    buildToolsVersion "19.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // google libraries (19)
    compile 'com.android.support:support-v4:19.1+'
    compile 'com.android.support:appcompat-v7:19.1+'
    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:recyclerview-v7:+'
}

#21


0  

In Android Studio 1.1.0: File - Project Structure - Tab Flavors - Select Min SDK Version which is higher than in Manifest

在Android Studio 1.1.0:文件-项目结构-标签口味-选择最小SDK版本,它高于显化。

#22


0  

I have the second solution:

我有第二个办法:

  1. unzip https://dl.dropboxusercontent.com/u/16403954/android-21.zip to sdk\platforms\
  2. 解压缩https://dl.dropboxusercontent.com/u/16403954/android - 21. - zip sdk \ \平台
  3. change build.gradle like

    改变构建。它就像

    compileSdkVersion 21
    buildToolsVersion "20.0.0"
    
    defaultConfig {
        applicationId "package.name"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    
  4. add

    添加

     
    

    in Manifest with xmlns:tools="schemas.android.com/tools";

    在清单xmlns:工具= "schemas.android.com/tools”;

  5. Go to sdk\extras\android\m2repository\com\android\support\support-v4\21.0.0-rc1\

    去android sdk \配件\ \ android m2repository \ com \ \ \ support-v4 \ 21.0.0-rc1 \支持

unpack support-v4-21.0.0-rc1.aar and edit AndroidManifest.xml like

解压缩support-v4-21.0.0-rc1。aar和编辑AndroidManifest。xml一样

from


to


P.S. You can do this with all support libraries that need.

您可以在需要的所有支持库中执行此操作。

#23


0  

The only thing that worked for me is this:

对我来说唯一有用的是:

In project.properties, I changed:

在项目。属性,我改变了:

cordova.system.library.1=com.android.support:support-v4:+ to cordova.system.library.1=com.android.support:support-v4:20.+

cordova.system.library.1 = com.android。支持:support-v4:+ cordova.system.library.1 = com.android.support:support-v4:20。+


推荐阅读
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 本文讨论了在openwrt-17.01版本中,mt7628设备上初始化启动时eth0的mac地址总是随机生成的问题。每次随机生成的eth0的mac地址都会写到/sys/class/net/eth0/address目录下,而openwrt-17.01原版的SDK会根据随机生成的eth0的mac地址再生成eth0.1、eth0.2等,生成后的mac地址会保存在/etc/config/network下。 ... [详细]
  • 如何搭建Java开发环境并开发WinCE项目
    本文介绍了如何搭建Java开发环境并开发WinCE项目,包括搭建开发环境的步骤和获取SDK的几种方式。同时还解答了一些关于WinCE开发的常见问题。通过阅读本文,您将了解如何使用Java进行嵌入式开发,并能够顺利开发WinCE应用程序。 ... [详细]
  • 基于PgpoolII的PostgreSQL集群安装与配置教程
    本文介绍了基于PgpoolII的PostgreSQL集群的安装与配置教程。Pgpool-II是一个位于PostgreSQL服务器和PostgreSQL数据库客户端之间的中间件,提供了连接池、复制、负载均衡、缓存、看门狗、限制链接等功能,可以用于搭建高可用的PostgreSQL集群。文章详细介绍了通过yum安装Pgpool-II的步骤,并提供了相关的官方参考地址。 ... [详细]
  • 本文介绍了闭包的定义和运转机制,重点解释了闭包如何能够接触外部函数的作用域中的变量。通过词法作用域的查找规则,闭包可以访问外部函数的作用域。同时还提到了闭包的作用和影响。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 关于我们EMQ是一家全球领先的开源物联网基础设施软件供应商,服务新产业周期的IoT&5G、边缘计算与云计算市场,交付全球领先的开源物联网消息服务器和流处理数据 ... [详细]
  • 本文介绍了在Linux下安装和配置Kafka的方法,包括安装JDK、下载和解压Kafka、配置Kafka的参数,以及配置Kafka的日志目录、服务器IP和日志存放路径等。同时还提供了单机配置部署的方法和zookeeper地址和端口的配置。通过实操成功的案例,帮助读者快速完成Kafka的安装和配置。 ... [详细]
  • 本文介绍了django中视图函数的使用方法,包括如何接收Web请求并返回Web响应,以及如何处理GET请求和POST请求。同时还介绍了urls.py和views.py文件的配置方式。 ... [详细]
  • FineReport平台数据分析图表显示部分系列接口的应用场景和实现思路
    本文介绍了FineReport平台数据分析图表显示部分系列接口的应用场景和实现思路。当图表系列较多时,用户希望可以自己设置哪些系列显示,哪些系列不显示。通过调用FR.Chart.WebUtils.getChart("chartID").getChartWithIndex(chartIndex).setSeriesVisible()接口,可以获取需要显示的系列图表对象,并在表单中显示这些系列。本文以决策报表为例,详细介绍了实现方法,并给出了示例。 ... [详细]
author-avatar
小新爱神起的小媳妇
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有