【问题标题】:Error with Pushwoosh cordova plugin on IonicIonic 上的 Pushwoosh cordova 插件出错
【发布时间】:2018-07-23 17:37:55
【问题描述】:

我刚刚在我的 Ionic 项目上安装了Pushwoosh cordova plugin,现在我无法在我的设备上运行该应用进行测试。

这里是官方docs

如果我运行: ionic cordova run android --consolelogs --device --livereload

我明白了:

:compileDebugJavaWithJavac
/media/ivan/SharedPartition/Trabajo/AnimaEdu/animaedu-mobile/platforms/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java:888: error: lambda expressions are not supported in -source 1.6

            mainHandler.post(() -> webView.loadUrl("javascript:"+ url));
                                ^
  (use -source 8 or higher to enable lambda expressions)
1 error
 FAILED
27 actionable tasks: 1 executed, 26 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
(node:18368) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /media/ivan/SharedPartition/Trabajo/AnimaEdu/animaedu-mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
/media/ivan/SharedPartition/Trabajo/AnimaEdu/animaedu-mobile/platforms/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java:888: error: lambda expressions are not supported in -source 1.6
            mainHandler.post(() -> webView.loadUrl("javascript:"+ url));
                                ^
  (use -source 8 or higher to enable lambda expressions)
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s

我不明白输出。

有什么想法吗?提前致谢!

【问题讨论】:

    标签: android cordova ionic-framework ionic3 pushwoosh


    【解决方案1】:

    问题很简单:

    错误原因 --> -source 1.6 不支持 lambda 表达式

    您正在使用JDK 1.6,而此插件的代码需要在JDK 1.8 或更高版本上编译。

    【讨论】:

    • $java -version : java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
    • javac 1.8.0_144
    • 但是你的 ionic 环境没有引用这个 java -version.check ionic 引用哪个版本?
    • 是的,但是我不知道该怎么做。当我运行ionic cordova run android 时,如果我在输出顶部看到它说:ANDROID_HOME=/home/ivan/Android JAVA_HOME=/usr/local/java/jdk1.8.0_144 Error: Requirements check failed for JDK 1.8 or greater
    • 您是否按照 Cordova 说明中所述设置了 JAVA_HOME 环境变量-cordova.apache.org/docs/en/latest/guide/platforms/android/…
    猜你喜欢
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    相关资源
    最近更新 更多