添加play-services-maps依赖关系会自动添加glEsVersion 2.0要求 [英] adding play-services-maps dependancy auto adds glEsVersion 2.0 requirement
问题描述
我想与Google Play Services Maps
模块集成.
由于地图清单声明:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
Gradle
的清单合并将此块添加到生成的清单中,从而使运行OpenGL 1.0
的设备不支持我的应用程序,但是我的地图功能不是必需的,我确实希望支持这些设备.
Gradle
's manifest merger adds this block to the resulting manifest making my app not supported on devices running OpenGL 1.0
, however my Maps feature is not mandatory, and I do want to support these devices.
我尝试将以下其中一项添加到自己的清单中:
I've tried adding to my own manifest one of these:
<uses-feature
android:glEsVersion="0x00010000"
android:required="false" />
或
<uses-feature
android:glEsVersion="0x00010000"
android:required="false"
tools:replace="glEsVersion,required" />
或
<uses-feature
android:glEsVersion="0x00010000"
android:required="false"
tools:node="remove"
tools:replace="glEsVersion,required"/>
但是没有任何效果,要么它自动选择一个最大值(2.0),要么将两个块都添加到结果清单中,仍然使我的应用程序要求2.0
But nothing works, either it automatically chooses the one with the highest value (2.0), or it adds both blocks to the resulting manifest, still making my app require 2.0
推荐答案
我能够通过手动覆盖合并的清单资源来使用build.gradle
黑客解决它.
I was able to solve it using build.gradle
hacks, by manually overriding the merged manifest source.
但是,我希望使用Gradle's manifest merger
工具(tools:node
,tools:replace
等)更优雅的方式
However I would prefer a more elegant way using Gradle's manifest merger
tools (tools:node
, tools:replace
, etc.)
我从AndroidManifest
中删除了glEsVersion
,并将以下内容添加到了build.gradle
中:
I removed the glEsVersion
from AndroidManifest
, and added the following to my build.gradle
:
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processManifest.doLast {
def manifestOutFile = output.processManifest.manifestOutputFile
def newFileContents = manifestOutFile.getText('UTF-8').replace("android:glEsVersion=\"0x00020000\"", "android:glEsVersion=\"0x00010000\"")
manifestOutFile.write(newFileContents, 'UTF-8')
}
}
}
这篇关于添加play-services-maps依赖关系会自动添加glEsVersion 2.0要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!