简体   繁体   English

强制将API从26.1降级到25.4

[英]Force to downgrade API from 26.1 to 25.4

I started a project with API 26. After some time I decided that I want to go with API 25, thus I replaced compileSdkVersion , targetSdkVersion and minSdkVersion 26->25. 我用API 26开始了一个项目。过了一段时间我决定使用API​​ 25,因此我更换了compileSdkVersiontargetSdkVersionminSdkVersion 26-> 25。 However, I keep getting error upon gradle sync/build saying: 但是,我在gradle sync / build上遇到错误:

Error:Execution failed for task ':app:processDebugManifest'. 错误:任务':app:processDebugManifest'的执行失败。 Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:design:25.4.0] AndroidManifest.xml:28:13-35 is also present at [com.android.support:support-core-utils:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). 清单合并失败:来自[com.android.support:design:25.4.0]的属性meta-data#android.support.VERSION@value value =(25.4.0)AndroidManifest.xml:28:13-35也出现在[com.android.support:support-core-utils:26.1.0] AndroidManifest.xml:28:13-35 value =(26.1.0)。 Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override. 建议:在AndroidManifest.xml:26:9-28:38中添加'tools:replace =“android:value”'来覆盖。

At first I saw that some "External Libraries" (such as core-utils) still point to 26.1.0 so I tried to force using 25.4.0 in build.gradle file but it still links 26.1 as you can see on the screenshot below. 起初我看到一些“外部库”(例如core-utils)仍然指向26.1.0所以我试图强制在build.gradle文件中使用25.4.0但它仍然链接26.1,你可以在下面的截图中看到。 What should I do to force downgrade to 25.4.0? 我该怎么做才能强制降级到25.4.0?

在此输入图像描述

When i encounter similar issues I perform two actions to pin point the problem; 当我遇到类似的问题时,我会执行两个动作来指出问题;

  1. Use ./gradlew <module_name>:dependencies to map out what is being transitively resolved to the unexpected support library version. 使用./gradlew <module_name>:dependencies将可传递解析的内容映射到意外的支持库版本。
  2. And armed with this information head on over to the module (looks like you only have 1 gradle module in your project) and then within that module's build.gradle explicitly define a resolutionStrategy such as; 并且将这些信息传递给模块(看起来你的项目中只有1个gradle模块),然后在该模块的build.gradle明确定义了resolutionStrategy ,如;

Snippet; 片段;

configurations.all {
    resolutionStrategy.force "com.android.support:support-core-utils:{version}"
}

Hope that helps. 希望有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM