首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cordova未能构建android (GCM依赖)

Cordova未能构建android (GCM依赖)
EN

Stack Overflow用户
提问于 2015-11-02 10:10:49
回答 3查看 7.7K关注 0票数 7

我已经为Android安装了最新的支持库软件包。

但是,我无法用离子型/科尔多瓦(第一次构建)编译我的新应用程序,我得到了以下错误:

代码语言:javascript
复制
TR: ~/Documents/bitron/B-See tommaso$ ionic run --device android
Running command: /Users/webdev1/Documents/bitron/B-See/hooks/after_prepare/010_add_platform_class.js /Users/webdev1/Documents/bitron/B-See
add to body class: platform-android
Running command: /Users/webdev1/Documents/bitron/B-See/platforms/android/cordova/run --device
ANDROID_HOME=/usr/share/java/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
Running: /Users/webdev1/Documents/bitron/B-See/platforms/android/gradlew cdvBuildDebug -b /Users/webdev1/Documents/bitron/B-See/platforms/android/build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-gcm:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
         file:/usr/share/java/android-sdk-macosx/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
         file:/usr/share/java/android-sdk-macosx/extras/android/m2repository/com/google/android/gms/play-services-gcm/
     Required by:
         :android:unspecified

* 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: 2.769 secs

/Users/webdev1/Documents/bitron/B-See/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /Users/webdev1/Documents/bitron/B-See/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/webdev1/Documents/bitron/B-See/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true
ERROR running one or more of the platforms: Error: /Users/webdev1/Documents/bitron/B-See/platforms/android/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
TR: ~/Documents/bitron/B-See tommaso$

这是我的插件列表:

代码语言:javascript
复制
TR: ~/Documents/bitron/B-See tommaso$ ionic plugin list
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-statusbar 1.0.1 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
ionic-plugin-keyboard 1.0.7 "Keyboard"
nl.x-services.plugins.toast 2.0.4 "Toast"
TR: ~/Documents/bitron/B-See tommaso$

我怎样才能解决这个问题?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2015-11-06 22:51:46

我再次解决了这个删除和添加平台的问题。

由于某些原因,我仍然有一些依赖于一个旧插件,我卸载。

票数 3
EN

Stack Overflow用户

发布于 2015-12-11 03:46:44

在我的例子中,这条消息是因为缺少Android中的包,所以需要通过安装一些软件包。

代码语言:javascript
复制
android # To open the SDK manager

寻找:

代码语言:javascript
复制
Extras -> Google play services
Extras -> Google repository

然后安装它们。

票数 30
EN

Stack Overflow用户

发布于 2015-11-02 11:38:31

根据这里的文件,您需要配置gradle构建系统(File: build.gradle)来安装gcm功能。

例如:

代码语言:javascript
复制
dependencies {
  compile "com.google.android.gms:play-services-gcm:8.1.0"
}

注意:通过使用cordova,可以自动生成build.gradle文件。这意味着每次调用cordova / ionic build时,添加的内容都会丢失。

cordova团队建议为自定义配置生成一个build-extras.gradle文件。

但是,对我来说,不清楚这些文件是如何合并的:-(这会导致您所面临的错误。

请阅读我的在此考虑来解决这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33475178

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档