PhoneGap Build - 无法为 org.gradle 类型的对象获取未知属性“GMS_VERSION”

Posted

技术标签:

【中文标题】PhoneGap Build - 无法为 org.gradle 类型的对象获取未知属性“GMS_VERSION”【英文标题】:PhoneGap Build - Could not get unknown property 'GMS_VERSION' for object of type org.gradle 【发布时间】:2019-01-04 12:38:46 【问题描述】:

从一天到另一天,我的构建现在都失败了,这些是我从 phonegap 构建中获得的日志:

Total time: 2.61 secs
Subproject Path: CordovaLib
"plugman-151 install --platform android --project /project --plugin cordova-plugin-splashscreen --nohooks=.": Fetching plugin "cordova-plugin-splashscreen" via npm
Installing "cordova-plugin-splashscreen" at "5.0.2" for android
Subproject Path: CordovaLib
null

FAILURE: Build failed with an exception.

* Where:
Build file '/project/build.gradle' line: 253

* What went wrong:
A problem occurred evaluating root project 'project'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.853 secs
Failed to install 'cordova-plugin-splashscreen': Error: /project/gradlew: Command failed with exit code 1
    at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
/project/gradlew: Command failed with exit code 1

我认为闪屏插件有问题,所以我将其降级,然后将其删除,但构建一直失败,抱怨另一个插件出现基本相同的错误。 我对 Gradle 文件了解不多,据我了解,PhoneGap Build 会处理它,或者至少它应该处理它。

我使用的是 Phonegap-cli 6.4,并且该版本适用于 Android。

如果您需要更多信息来帮助,请告诉我,非常感谢:)

更新:获得成功构建的唯一方法是从 config.xml 中删除所有插件 :'( :'( :'(...现在?仍然试图找出另一种添加插件的方法.

更新 2:如果我使用 Phonegap-Cli 7.0.1,这些是日志

--------------------------------------------------------------------------------
COMPILE OUTPUT
--------------------------------------------------------------------------------
:wrapper

BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Subproject Path: CordovaLib
null
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
    at build_3165fehnqtadtl3m714hg3us5.run(/build.gradle:138)

FAILURE: Build failed with an exception.

* Where:
Build file '/build.gradle' line: 253

* What went wrong:
A problem occurred evaluating root project 'www_android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.08 secs
Error: /gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file '/build.gradle' line: 253

* What went wrong:
A problem occurred evaluating root project 'www_android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    at ChildProcess.whenDone (/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

类似的错误 - 不知道发生了什么

【问题讨论】:

【参考方案1】:

我成功构建,删除了我的 config.xml 中的这一行

<plugin name="cordova-plugin-google-analytics" source="npm" />

这个插件可能有问题...

祝你好运!

【讨论】:

非常感谢,奇怪的是,删除该插件修复了构建 :) 因为我实际上需要那个插件,所以我一直在寻找一个兼容的版本,我已经从最新的版本 (1.8.6) 降级了到 1.8.4 并且它仍在工作:)

以上是关于PhoneGap Build - 无法为 org.gradle 类型的对象获取未知属性“GMS_VERSION”的主要内容,如果未能解决你的问题,请参考以下文章

Phonegap Build Repository插件无法访问

“无法下载应用程序......此时无法安装” - adobe phonegap build ios

Phaser HTML5 应用程序通过Phonegap Cloud Build 移植后无法播放声音

phonegap build,用于检查网络连接的连接插件

在 Android Phonegap Build 中集成广告

Urban Airship phonegap 3.5 with Phonegap Build