android studio repo,Android Support Repo 46.0.0 with Android Studio 2.3

问题

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

I go the error below :

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

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.

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.

This link shows the changes:

https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0-alpha1

And concerning migrating to the new android O, that\'s the link:

https://developer.android.com/preview/migration.html

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

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

android:name=\"android.support.VERSION\"

android:value=\"26.0.0-alpha1\" />

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

回答1:

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.

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

What's the solution

Fortunately you can force a specific support library version.

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.

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

If you have doubts

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

What can you do to help

Find the libraries which depend on a range of support library versions

gradlew dependencies --configuration compile -p | 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.

回答2:

Step 1

To escape Gradle checking for incompatible com.android.support versions a quick fix is to add following code in app module build.gradle.

dependencies {

//noinspection GradleCompatible

}

This is a temporary fix that doesn't solve the underlying problems! It helped to continue develop your app with minimal modifications.

Step 2

Add this to the main manifest file AndroidManifest.xml.

tools:replace="android:value"

android:name="android.support.VERSION"

android:value="25.3.1" />

This entry will be removed when one of the next updates of the support repository is available.

Step 3

Add the following code at the end of app module build.gradle file:

configurations.all {

resolutionStrategy.eachDependency { details ->

def requested = details.requested

if (requested.group == 'com.android.support') {

if (!requested.name.startsWith("multidex")) {

details.useVersion '25.3.1'

}

}

}

}

NB: It is recommended to make sure your Gradle libraries are updated and compatible to avoid runtime errors.

回答3:

Their is a solution to fix it out:

Move to Project explorer view

Reach to bottom their is External Libraries

See which library is using 26.0.0-alpha6

Now write this in app.gradle on the basis of library in Step 3

Ex. in my case:

configurations.all {

resolutionStrategy.force 'com.android.support:appcompat-v7:25.3.0'

resolutionStrategy.force 'com.android.support:support-v13:25.3.0'

}

This will force project to use mentioned library.

回答4:

I think the best solution is to just revert the Android Support Library to version 45.

To do this, open this link (change version to whatever suits your needs)

https://dl-ssl.google.com/android/repository/android_m2repository_r45.zip

When downloaded, unzip and copy m2repository to android-sdk-root-folder\extras\android. Make sure to delete the existing m2repository prior to unzipping to avoid problems.

回答5:

This is a temporary fix that doesn't solve the underlying problems! It helped me continuing developing software with minimal modifications. Just add this to the main manifest:

tools:replace="android:value"

android:name="android.support.VERSION"

android:value="25.3.0" />

This entry can hopefully be removed again with one of the next updates of the support repository.

SOLUTION:

The marked solution worked for me by adding the following to 4 of my 10 build.gradle files:

configurations.all {

resolutionStrategy.eachDependency { details ->

def requested = details.requested

if (requested.group == 'com.android.support') {

if (!requested.name.startsWith("multidex")) {

details.useVersion '25.3.0'

}

}

}

}

回答6:

just do this that's all :-

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

here v7:25.3.1 is my current version you just put urs.

in app gradle file

回答7:

to me the problem was that the versions weren't the same in here

implementation 'com.android.support:appcompat-v7:**26.0.0-beta1**'

implementation 'com.android.support:support-v4:**26.0.0-beta1**'

implementation 'com.android.support:design:**26.0.0-beta1**'

and the card view was

compile 'com.android.support:cardview-v7:26.1.0'

so i changed the version libraries to..

implementation 'com.android.support:appcompat-v7:26.1.0'

implementation 'com.android.support:support-v4:26.1.0'

implementation 'com.android.support:design:26.1.0'

hope this help, good luck

来源:https://stackoverflow.com/questions/42949974/android-support-repo-46-0-0-with-android-studio-2-3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值