android - Cordova 无法使用 cordova-plugin-local-notifications 构建

标签 android cordova android-notifications cordova-plugins

我已经使用这个命令添加了通知插件:

cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git

但是,当我构建应用程序时,它失败并出现以下错误。

> cordova build android --release

ANDROID_HOME=E:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31

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-v4:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v4/
     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: 4.119 secs
Error: Error code 1 for command: cmd with args: /s,/c,"E:\PhoneGap\MyApp\platforms\android\gradlew 
cdvBuildRelease -b E:\PhoneGap\MyApp\platforms\android\build.gradle 
-Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

最佳答案

我有类似的问题,我找到了解决方法。创建平台后,用android Studio打开platform/android文件夹

在项目左侧标签中,在android中左键点击,选择“Open Module Settings”

转到“依赖项”选项卡,单击“+”和“库依赖项”

选择“支持v4”,点击“确定”

现在您可以构建它了。

也可以通过添加

<framework src="com.android.support:support-v4:+" />

到你的 config.xml,但它对我不起作用

此外,您还有更多信息:

https://github.com/phonegap-build/PushPlugin/issues/492

也许这对你有帮助。

请发布你的结果

关于android - Cordova 无法使用 cordova-plugin-local-notifications 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36547338/

相关文章:

cordova - RedLaser 和 PhoneGap 插件

ios - Phonegap - iOS 教程中的差距?

windows - PhoneGap Build - Windows 键不在选择框中

android - 为什么 Android 通知的 LED 设置不起作用

java - 如何显示来自广播接收器的通知?

android - 点击通知后如何打开特定屏幕?

android - 构建失败,出现异常

java - 检查 Firebase 中是否存在值有一个奇怪的问题

java - 从包含特殊字符的 url 下载图像

java - 可滚动弧形轮 查看