在 mac 上将推送通知插件添加到项目时构建失败

build failed when push notification plug in added to project on mac

我正在使用 PhoneGap 构建应用程序。 应用程序在模拟器上运行正常,但将推送通知插件添加到项目时会出现构建错误。 我搜索了这个问题...最初发现它是许多人的常见问题...尝试了所有解决方案...但仍然是相同的构建错误。

这是插件

sudo cordova plugin add phonegap-plugin-push

其中一个解决方案说尝试使用 1.2.3 版本的推送通知,即

sudo cordova plugin add phonegap-plugin-push@1.2.3

使用这个版本没有错误,但是它是旧版本需要最新版本的解决方案。 最新的正在 windows 机器上工作,但不在 MAC.

这里是使用最新版本时的详细错误

ANDROID_HOME=/Users/bunty/Library/android-sdk-macosx
 JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home

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.android.support:support-v13:23+.
 Searched in the following locations:
     https://repo1.maven.org/maven2/com/android/support/support-v13/maven-metadata.xml
     https://repo1.maven.org/maven2/com/android/support/support-v13/
 Required by:
     :android:unspecified
> 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/
 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: 37.885 secs
Error: Error code 1 for command:     /Users/bunty/Documents/ParsianaApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/bunty/Documents/ParsianaApp/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

任何人都可以帮忙吗?

不要使用 sudo 进行安装。它会导致权限问题。

如果您阅读 install guide

You will need to ensure that you have installed the following items through the Android SDK Manager:

Android Support Library version 23 or greater
Android Support Repository version 20 or greater
Google Play Services version 27 or greater
Google Repository version 22 or greater

您可以手动完成或使用此命令:

android update sdk --no-ui --filter "extra"