在cordova config.xml中

时间:2017-06-20 11:11:20

标签: android cordova gradle phonegap

我试图添加确切的依赖项,但看起来在 /platforms/android/project.properties /platforms/android/build.gradle中忽略了所有依赖项

config.xml中

<widget>
    <platform name="android">
        <framework src="com.google.android.gms:play-services-analytics:9.8.0" />
        <framework src="com.google.gms.google-services:9.8.0" />
    </platform>
    <engine name="android" spec="6.2.3" />
    <engine name="cordova" spec="6.5.0" />
    <engine name="npm" spec="4+" />
</widget>

输出结果为:

project.properties

android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-analytics:+

的build.gradle

dependencies {
    compile "com.google.android.gms:play-services-analytics:+"
}

1 个答案:

答案 0 :(得分:1)

您无法在<framework>中添加config.xml代码:它们是supported in plugin.xml但不是config.xml

但是,要实现您要执行的操作(将Play服务版本强制转换为v9),您可以使用cordova-android-play-services-gradle-release

cordova plugin add https://github.com/dpa99c/cordova-android-play-services-gradle-release#v9

该分支包含bit of Gradle config以将版本覆盖为v9。