Best IDE for Android with JavaScript?

Hello,

My Hype project has .js and .css files for small and simple game widgets (bookry). I’ve been able to get them working just fine in Xcode WebViews. Once that was accomplished, I installed Android Studio and could not get it working no matter how I coded??? Found out that it doesn’t really support Javascript but other IDEs do. Does anyone have an opinion of the best IDE to use? Ionic, React Native, Adobe AppGap? I’m also hoping to just have one resource folder like I use in Xcode. Thanks for any help you can provide.

Android Studio does support JavaScript. Well, at least it supports embedding HTML pages and run JavaScript into WebViews. If you’re talking about completely building an Android app using just JavaScript (and avoiding Java, Kotlin, or any other language), well, you’re out of luck.

Understood and agreed. I think my problem revolves around Android Studio’s and that it doesn’t support the native use of JavaScript. But I’m not an expert. I have created an interactive ebook in Hype that is mostly html but has a few widgets that use JavaScript. Everything works fine in Xcode and all but the JavaScript works in Android Studio. I’ve tried three paths of code that do not seem to activate JavaScript for my project in AS.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView myApp = (WebView)findViewById(R.id.myApp);
    myApp.getSettings().setJavaScriptEnabled(true);
    myApp.setWebChromeClient(new WebChromeClient());
    //WebSettings webSettings = myApp.getSettings();
    //webSettings.setJavaScriptEnabled(true);
    //myApp.setWebViewClient(new WebViewClient());
    myApp.loadUrl("file:///android_asset/LLD_Ver2.html");
}

}

You can try my source code of an empty Android app here: Android Faux App

While your code does appear to be correct, I guess, there’s some other error. Because, I had made this app specifically to load a website that I had made completely in Hype and it had worked.

Is the IDE giving some error, or something? And what do you mean by JS is not getting activated? Does your HTML page render blank? If yes, try adding the <noscript> element on the HTML page to be sure it’s the disabled JS that’s causing the problem.

2 Likes

So, when I click on the link to my JavaScript game, the app crashes under Android Studio Emulator. I don’t see any errors in the logging at the time of the crash.

Video of the issue… VIDEO

Error on the emulated device…

A crash can be due to a lot of stuff.

Firstly, I’d recommend to try on a real, physical device instead of the emulator.

Secondly, if a physical device isn’t available, the logs can help. The logs are available in Android Studio and not the device. You might want to try to watch a video on how to debug in Android Studio.

Another thing I can suggest is, upload your HTML files to a static server like Netlify or run a local server on Android and preview your app there first. If the JavaScript runs fine there, something might be wrong in the app’s code.

2 Likes