Cordrova 后台地理定位 phonegap 构建失败
Cordrova background geolocation phonegap build fails
我已经安装了 cordova-plugin-mauron85-background-geolocation
但构建在 android 上失败并显示此消息,我无法弄清楚问题所在。
这是来自 phonegap 构建日志的错误消息。
其中:
构建文件“/project/build.gradle”行:253
出了什么问题:
评估根项目 'project'.
时出现问题
Could not get unknown property 'GOOGLE_PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
这是我的config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="no.twn.androidapp" version="1.0.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>temp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="phonegap-version" value="cli-6.5.0" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-build-tool" value="gradle" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="^4.4.0" />
<engine name="android" spec="^6.3.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.3.3">
<variable name="GOOGLE_PLAY_SERVICES_VERSION" value="+" />
<variable name="ICON" value="@mipmap/icon" />
<variable name="SMALL_ICON" value="@mipmap/icon" />
<variable name="ACCOUNT_NAME" value="@string/app_name" />
<variable name="ACCOUNT_LABEL" value="@string/app_name" />
<variable name="ACCOUNT_TYPE" value="$PACKAGE_NAME.account" />
<variable name="CONTENT_AUTHORITY" value="$PACKAGE_NAME" />
<variable name="ALWAYS_USAGE_DESCRIPTION" value="This app always requires location tracking" />
</plugin>
</widget>
这可能会有所帮助:
为了与其他插件兼容,您还可以设置特定的 google 播放版本。以下示例将 google 播放服务锁定到版本 11.0.1 以与 phonegap-plugin-push 兼容。注意:始终查阅其他插件的文档以找出正确的 GOOGLE_PLAY_SERVICES_VERSION.
我也遇到了同样的问题。
我尝试更新 android sdk,但没有用。
[
我尝试删除并添加平台 android,但没有成功。
我尝试删除并添加 cordova-plugin-backgroud-geolocation,它成功了。
[
这些天我也一直在努力 运行 Phonegap Build 中的这个插件,这是我的发现:
不幸的是,2.3.x 版本似乎只能在 v2.6.0 android 上工作,而 supported 还没有。
尝试使用插件的 v2.2.5,似乎在 PB 中工作(因为此插件的版本 3 尚未在 cordova repo 中发布)。
我已经安装了 cordova-plugin-mauron85-background-geolocation
但构建在 android 上失败并显示此消息,我无法弄清楚问题所在。
这是来自 phonegap 构建日志的错误消息。
其中: 构建文件“/project/build.gradle”行:253
出了什么问题: 评估根项目 'project'.
时出现问题Could not get unknown property 'GOOGLE_PLAY_SERVICES_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
这是我的config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="no.twn.androidapp" version="1.0.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>temp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<preference name="phonegap-version" value="cli-6.5.0" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-build-tool" value="gradle" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="^4.4.0" />
<engine name="android" spec="^6.3.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.3.3">
<variable name="GOOGLE_PLAY_SERVICES_VERSION" value="+" />
<variable name="ICON" value="@mipmap/icon" />
<variable name="SMALL_ICON" value="@mipmap/icon" />
<variable name="ACCOUNT_NAME" value="@string/app_name" />
<variable name="ACCOUNT_LABEL" value="@string/app_name" />
<variable name="ACCOUNT_TYPE" value="$PACKAGE_NAME.account" />
<variable name="CONTENT_AUTHORITY" value="$PACKAGE_NAME" />
<variable name="ALWAYS_USAGE_DESCRIPTION" value="This app always requires location tracking" />
</plugin>
</widget>
这可能会有所帮助: 为了与其他插件兼容,您还可以设置特定的 google 播放版本。以下示例将 google 播放服务锁定到版本 11.0.1 以与 phonegap-plugin-push 兼容。注意:始终查阅其他插件的文档以找出正确的 GOOGLE_PLAY_SERVICES_VERSION.
我也遇到了同样的问题。 我尝试更新 android sdk,但没有用。
[
我尝试删除并添加平台 android,但没有成功。 我尝试删除并添加 cordova-plugin-backgroud-geolocation,它成功了。
[
这些天我也一直在努力 运行 Phonegap Build 中的这个插件,这是我的发现:
不幸的是,2.3.x 版本似乎只能在 v2.6.0 android 上工作,而 supported 还没有。 尝试使用插件的 v2.2.5,似乎在 PB 中工作(因为此插件的版本 3 尚未在 cordova repo 中发布)。