带有Android Studio 2.3的Android支持回购46.0.0 [英] Android Support Repo 46.0.0 with Android Studio 2.3

查看:85
本文介绍了带有Android Studio 2.3的Android支持回购46.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Android Studio通知弹出时,我今天将我的支持存储库更新为46.0.0.

I updated today my support repository to 46.0.0 as the Android Studio notification popped up.

我遇到以下错误:

错误:任务':app:processDevDebugManifest'的执行失败.

Error:Execution failed for task ':app:processDevDebugManifest'.

清单合并失败:属性meta-data#android.support.VERSION@value value =(25.3.0)来自 [com.android.support:support-v13:25.3.0] AndroidManifest.xml:27:9-31 也出现在[com.android.support:preference-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value =(26.0.0-alpha1).意见建议:添加 'tools:replace ="android:value"'到元素 AndroidManifest.xml:25:5-27:34进行覆盖.

Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.0) from [com.android.support:support-v13:25.3.0] AndroidManifest.xml:27:9-31 is also present at [com.android.support:preference-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.

我将所有依赖项更新为从25.3.0使用修订版26.0.0 Alpha 1,但事实证明我需要将compileSdk从25提升到26. 如果您使用的是AS 2.3,则无法执行此操作,则需要从金丝雀中获取不稳定的alpha/beta版本.

I updated all my dependencies to use Revision 26.0.0 Alpha 1 from 25.3.0, but it turns out I need to bump the compileSdk from 25 to 26. You can't do that if you have AS 2.3, you need to get the unstable alpha/beta version from canary.

此链接显示更改: https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0-alpha1

关于迁移到新的android O,这是链接: https://developer.android.com/preview/migration.html

And concerning migrating to the new android O, that's the link: https://developer.android.com/preview/migration.html

使用AS稳定版似乎无法与新存储库一起使用.

It seems using AS stable version will not work with new repository.

如何返回Android Studio存储库版本45,而不是新版本46?

How can I go back to the Android Studio Repository Version 45 instead of the new 46?

**更新:合并的清单显示了其中一个生成的库清单包含

** Update: The merged manifest shows one of the generated library manifest contains

<meta-data
        android:name="android.support.VERSION"
        android:value="26.0.0-alpha1" />

但是由于它是生成的文件,所以编辑是没有用的,这就是为什么现在我坚持45版,直到新的AS稳定构建

But since it's a generated file editing is useless, that's why for now I'd stick to rev 45 until the new AS is in stable build

推荐答案

出了什么问题

某些库依赖于Android支持库的"X或更高版本",因此Gradle依赖项解析会获取最新可用的内容,而忽略了您实际上在dependencies块中指定了确切版本的情况.

What's the problem

Some libraries depend on version "X or newer" of Android support libraries so Gradle dependency resolution grabs whatever is the newest available ignoring you actually have a precise version specified in your dependencies block.

这不是您想要的.您希望所有具有相同版本和主要版本的支持库都必须与编译SDK版本匹配.

This is not what you want. You want all support libraries with same version and major version has to match compile SDK version.

幸运的是,您可以强制使用特定的支持库版本.

Fortunately you can force a specific support library version.

将其放置在应用程序模块的 build.gradle:

Put this at the end of your app module build.gradle:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            // Skip multidex because it follows a different versioning pattern.
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

当然可以用您正在使用的版本替换该版本.

Of course replace the version with whatever it is you're using.

dependecies块中支持库的版本值现在不相关.

Version values for support libraries in dependecies block are now irrelevant.

这是一个详细记录的方法,并且可以正常工作.

This is a well documented method and it's working.

找到依赖于支持库版本范围的库

gradlew dependencies --configuration compile -p <module name> | grep ,

并让上述库的作者知道他们应该可传递地依赖他们的库可以使用的最早的支持库.

and let the authors of said libraries know they should transitively depend on the oldest support libs their library can do with.

这旨在完全避免该问题.

This aims to avoid the issue altogether.

这篇关于带有Android Studio 2.3的Android支持回购46.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆