添加play-services-maps依赖关系会自动添加glEsVersion 2.0要求 [英] adding play-services-maps dependancy auto adds glEsVersion 2.0 requirement

查看:195
本文介绍了添加play-services-maps依赖关系会自动添加glEsVersion 2.0要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想与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:nodetools: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆