如何在Android Studio中设置兼容库

问题描述 投票:0回答:1

我知道这个问题以前有人问过,但似乎在以前的问题中找不到答案,所以这里说一下。

我在Unity中创建了一个项目,并将其导出到Android Studio中。我已经将最小API级别设置为4.4 KitKat(API级别19)。

我在主清单文件中添加了:。当构建时,我得到这个错误。

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:UniWebView:] /Users/myname/.gradle/caches/transforms-2/files-2.1/97563e885486a53e4f6658e98b58f094/jetified-UniWebView/AndroidManifest.xml as the library might be using APIs not available in 19
    Suggestion: use a compatible library with a minSdk of at most 19,
        or increase this project's minSdk version to at least 21,
        or use tools:overrideLibrary="com.onevcat.uniwebview" to force usage (may lead to runtime failures)

如何设置兼容库为minSdk 19?它需要是19,而不是21,因为如果我发布21的更新,几乎20%的用户将无法玩这个游戏:-。

Units not compatible with API level 21+ = 2054 (19%)

事实上... 一个小问题... 我是否应该害怕升级API会失去用户?我有一个使用API等级21的版本,准备发布。

如果我应该小心,如何解决最初的问题?

希望得到帮助,提前感谢:-)

android api android-studio unity3d android-manifest
1个回答
0
投票

你基本上有4个选项。

  1. 增加你的项目的minSdk到21,并失去用户。
  2. 添加 tools:overrideLibrary="com.onevcat.uniwebview" 到你的manifests的应用标签,这很可能会导致你的API 19用户的运行时崩溃(如果你选择这个选项,请大量测试整个事情!!!)。
  3. 扔掉这个库,再找一个。或者写自己的解决方案
  4. Fork这个库(如果是开源的),并尝试将其minSdk减少到19。

如果我是你的话,我会选择第三种方案。

© www.soinside.com 2019 - 2024. All rights reserved.