title: Android Webview Javascript - References to Scripts not working
body: <p>Developing on Android Studio 1.0.1, API 21. Following is the folder structure -
  <img src="https://i.stack.imgur.com/yJbGK.png" alt="enter image description here"></p>
  
  <p>It's essentially an AngularJS based app that I want to wrap inside a webview container and run on Android.</p>
  
  <p>My Android side of code is -</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> WebView myWebView = (WebView) findViewById(R.id.webview);
   WebSettings webSettings = myWebView.getSettings();
   webSettings.setJavaScriptEnabled(true);
   webSettings.setDomStorageEnabled(true);
   myWebView.setWebChromeClient(new WebChromeClient());
  
   String filePath = "file:///android_asset/www/index.html";
   myWebView.loadUrl(filePath);</code></pre>
  </div>
  </div>
  </p>
  
  <p>The references in html are all relative -</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="lib/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-route.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/bootstrap.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But interestingly enough, I've searched most places, and I'm not sure where am I going wrong. My references aren't working at all! So I can't access my lib files, my scripts, my css.
  Also, if I run an external angular web page inside the webview, with the same Java code, it runs perfectly!</p>
  
  <p>Any help is appreciated.</p>
  
  <p><strong>Note :</strong> Please don't suggest using Cordova/PhoneGap. It's a project requirement to go native(and I frankly don't understand why, but I'm only a developer who has no say in it).</p>
  
  <p><strong>On a side note :</strong> I'm facing the same problem with the iOS webview. References aren't working!</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Tried the following things :</p>
  
  <p>Tried <code>loadDataWithBaseURL()</code>, doesn't work.</p>
  
  <p>Tried all possible scenarios for paths. Nothing worked.</p>
  
  <p>Removed all the scripts from the folder and put them at the root level, and modified links to have no paths, simply file names. Still doesn't work. And this is way too weird.</p>