Having my minimum API set to 16, everything seems to be working fine. However, debugging has become quite a challenge. I've read that after API 19, the Chrome debugger can be used. But when it comes to interfacing with Java code, I encounter the error "TypeError: Android.JavaMethod is not a function". This issue arises while using Angular for a hybrid app, which functions smoothly on iOS with the Safari debugger. The same code needs adjustments to run on Android, and I require the debugger to help me figure it out. What could possibly be causing this problem?
The error message displayed:
[INFO:CONSOLE(11594)] "TypeError: Android.JavaMethod is not a function
09-05 15:24:28.103: I/chromium(18021): at myJavaMethod
(file:///android_asset/my_angular/MyFile.js:217:18)
09-05 15:24:28.103: I/chromium(18021): at Object.<anonymous>
(file:///android_asset/my_angular/MyFile.js:901:67)
...
Contents of my JS file:
function myJavaMethod(curData)
{
return(Android.JavaMethod(curData));
} // --- end of myJavaMethod ---
... more code followed by its invocation from the angular controller
$scope.myCopy = myJavaMethod('arg');
...
Content from my java file:
Weby1.setWebViewClient(new WebViewClient());
Weby1.loadUrl("file:///android_asset/my_angular_hl/index.html");
// calling interface to android
Weby1.addJavascriptInterface(new JavaScriptInterface(this), "Android");
...
public class JavaScriptInterface
{
Context mContext;
JavaScriptInterface(Context c) {
mContext = c;
}
public String JavaMethod(String arg)
{
..stuff
return str;
}
...more methods