我正在使用 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
有人可以帮忙吗?
最佳答案
如果您阅读 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"
关于ios - 在 Mac 上将推送通知插件添加到项目时构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35291278/