Reputation: 367
Below is the full error message
C:\joel1\joel1\platforms\android\src\de\appplant\cordova\plugin\localnotificatio n\LocalNotification.java:495: error: cannot find symbol webView.evaluateJavascript(js, null); ^ symbol: method evaluateJavascript(String,) location: variable webView of type CordovaWebView C:\joel1\joel1\platforms\android\src\de\appplant\cordova\plugin\localnotificatio n\LocalNotification.java:492: error: cannot find symbol webView.post(new Runnable(){ ^ symbol: method post() location: variable webView of type CordovaWebView 2 errors :compileDebugJava FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':compileDebugJava'.
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.
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 -PcdvBui ldArch=arm -Dorg.gradle.daemon=true" ERROR running one or more of the platforms: Error: C:\joel1\joel1\platforms\andr oid\cordova\run.bat: Command failed with exit code 8 You may not have the required environment or OS to run this project
Upvotes: 1
Views: 1068
Reputation: 1313
In platforms/android/src/de/appplant/cordova/plugin/localnotification/LocalNotification.java file
private static synchronized void sendJavascript(final String js) {
if (!deviceready) {
eventQueue.add(js);
return;
}
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);
}
}
});
// webView.post(new Runnable(){
// public void run(){
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// webView.evaluateJavascript(js, null);
// } else {
// webView.loadUrl("javascript:" + js);
// }
// }
// });
}
https://github.com/katzer/cordova-plugin-local-notifications/issues/426
Upvotes: 0
Reputation: 12620
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
Upvotes: 1