问题描述
以下是完整的错误讯息
C:\joel1\joel1\platforms\android\src\de\appplant\cordova \plugin\localnotificatio
n\LocalNotification.java:495:错误:找不到符号
webView.evaluateJavascript(js,null);
^
符号:方法evaluateJavascript(String,)
位置:变量webView类型CordovaWebView
C:\joel1\joel1\platforms\android\src\\ \\de \appplant\cordova\plugin\localnotificatio
n \LocalNotification.java:492:错误:找不到符号
webView.post(new Runnable(){
^
符号:方法post()
位置:变量webView类型CordovaWebView
2错误
:compileDebugJava FAILED
FAILURE:
-
出现错误:
任务'compileDebugJava'执行失败。 p>
-
尝试:
/ li>
使用--stacktrace选项运行以获取堆栈跟踪使用--info或--debug
选项运行以获取更多日志输出。
BUILD FAILED
总时间:5.529秒
C:\joel1\joel1\platforms\android\cordova\\\
ode_modules\q\q.js:126
throw e;
^
命令的错误代码1:cmd with args:/ s / cC:\joel1\joel1\platforms\android
\gradlew cdvBuildDebug -b C: \joel1\joel1\platforms\android\build.gradle -PcdvBui
ldArch = arm -Dorg.gradle.daemon = true
运行一个或多个平台的错误:错误: C:\joel1\joel1\platforms\andr
oid\cordova\run.bat:退出代码为8的命令失败
您可能没有运行所需的环境或操作系统修改 $ c>与以下:
webView.getView()。post(new Runnable(){
public void run(){
if(Build.VERSION.SDK_INT> = Build.VERSION_CODES.KITKAT){
webView.sendJavascript(js);
} else {
webView.loadUrl (javascript:+ js);
}
}
});
Below is the full error message
C:\joel1\joel1\platforms\android\src\de\appplant\cordova\plugin\localnotification\LocalNotification.java:495: error: cannot find symbol webView.evaluateJavascript(js, null); ^ symbol: method evaluateJavascript(String,) location: variable webView of type CordovaWebViewC:\joel1\joel1\platforms\android\src\de\appplant\cordova\plugin\localnotification\LocalNotification.java:492: error: cannot find symbol webView.post(new Runnable(){ ^ symbol: method post() location: variable webView of type CordovaWebView2 errors:compileDebugJava FAILED
FAILURE: Build failed with an exception.
What went wrong:Execution failed for task ':compileDebugJava'.
Try:Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.
BUILD FAILED
Total time: 5.529 secs
C:\joel1\joel1\platforms\android\cordova\node_modules\q\q.js:126 throw e; ^Error code 1 for command: cmd with args: /s /c "C:\joel1\joel1\platforms\android\gradlew cdvBuildDebug -b C:\joel1\joel1\platforms\android\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true"ERROR running one or more of the platforms: Error: C:\joel1\joel1\platforms\android\cordova\run.bat: Command failed with exit code 8You may not have the required environment or OS to run this project
Quick fix is to modify the block starting at LocalNotification.java:492 with the following:
webView.getView().post(new Runnable(){ public void run(){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { webView.sendJavascript(js); } else { webView.loadUrl("javascript:" + js); } } });
https://github.com/katzer/cordova-plugin-local-notifications/issues/535
这篇关于当我使用CLI命令失败,并且退出代码为8时,在本地通知插件上添加最新版本时,构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!