android - Cordova 无法在 android 上构建(GCM 依赖项)

标签 android cordova gradle google-cloud-messaging ionic-framework

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

但是我无法使用 ionic/cordova(第一次构建)编译我的新应用程序,并且出现以下错误:

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$

这是我的插件列表:

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$

我该如何解决这个问题?

最佳答案

就我而言,此消息是因为 Android SDK 中缺少包,因此需要通过 Android SDK 管理器安装一些包。

android # To open the SDK manager

寻找:

Extras -> Google play services
Extras -> Google repository

并安装它们。

关于android - Cordova 无法在 android 上构建(GCM 依赖项),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33475178/

相关文章:

android - aapt 总是压缩资源文件

ios - 无法在新的 ios8 中运行我的 cordova 应用程序

java - IntelliJ 2019.2.2 : Unable to debug gradle unit tests

java - 如何在 gradle jar 构建过程中更新属性文件中的值?

build-automation - 用于多个项目构建的多个设置 gradle 文件

android - Flutter Listview 在使用 FutureBuilder 加载缩略图时卡住

android - 我们如何在 Android 中将 null 定义为数据类型,就像我们在 iPhone 中定义 nsNull 一样

java - 如何修复 mysql 上的零(0)用户名

ios - 使用Cordova应用程序在iOS上列出附近的wifi网络

cordova - 推送通知WP8.1 "Invalid channel URL"