I'm using AIDE (A code editor / IDE & compiler which runs on Android) to write an Android app, and I want to add some assets to my project, specifically a HTML file plus associated CSS and JavaScript files, to be displayed in a WebView.
I've put my assets (a HTML file) in projectDirectory/app/src/main/assets/htmlfile.html
, but, when I use the code below to load it in WebView, it shows "File not found". The exact same thing works fine in Android Studio.
Where do I put this assets folder for AIDE to pick up its contents ?
Here is my code where I'm loading the WebView, although I don't think there's anything wrong here, as it works in Android Studio.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
setContentView(webView);
webView.loadUrl("file:///android_asset/htmlfile.html");
}
What I've tried:
Placing it in
/app/src/main/assets/htmlfile.html
(The usual location, which works in Android Studio).In
/app/src/main/res/assets/htmlfile.html
In
/app/src/assets/htmlfile.html
Pretty much everywhere else.
However, wherever I put it and recompile, the WebView always shows "File not found". So where do I put my assets folder for it to work with AIDE, or how do I make AIDE pick it up when compiling ? Does AIDE support assets at all ?
Doh: All I needed to do was menu > more > project > refresh build, with the assets in
/app/src/main/assets/htmlfile.html
and it worked. Somewhat non-obvious, but hey, solved my problem.Leaving this self answer in case anyone else has the same problem.