Resolved versions for app (26.1.0) and test app (2

2020-05-31 05:17发布

This is the full error-

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

I know that there are a lot of solutions to this type of answers but I am an absolute beginner in android studio and I couldnt understand those solutions like the command line interface interacting with gradle and so on...

I was looking for a simple solution to this problem if there is. Thanks a lot!

10条回答
男人必须洒脱
2楼-- · 2020-05-31 05:40

Use

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

instead of

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

and change compileSdkVersion 26 to 27

查看更多
Summer. ? 凉城
3楼-- · 2020-05-31 05:42
configurations.all{
    resolutionStrategy {
        force 'com.android.support:support-annotations:26.1.0'
    }
}
查看更多
Ridiculous、
4楼-- · 2020-05-31 05:42

This is the type of bug that really makes me resent Android Studio.

But anyway, the solution for me was quite simple: Edit the app.iml and change the com.android.support:support-annotations version. In this case it's easy to find, simply ctrl+F and type "27.1.1" (it should be the only hit) and change to your version "26.1.0".

In other words, change it from

<orderEntry type="library" scope="TEST" name="com.android.support:support-annotations:27.1.1@jar" level="project" />

to

<orderEntry type="library" scope="TEST" name="com.android.support:support-annotations:26.1.0@jar" level="project" />

Afterwards, rebuild the project. (simply rebuilding it wasn't working for me until i edited the app.iml)

查看更多
Root(大扎)
5楼-- · 2020-05-31 05:44

Use latest stable version of support library

Track here latest versions https://mvnrepository.com/artifact/com.android.support

As of 28-9-2018 latest version is 28.0.0.

  implementation 'com.android.support:appcompat-v7:28.0.0'
  implementation 'com.android.support:support-annotations:28.0.0'
查看更多
登录 后发表回答