Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:37:14+00:00 2026-06-10T03:37:14+00:00

I have a WebView in my activity, and using Proguard for obfuscation seems to

  • 0

I have a WebView in my activity, and using Proguard for obfuscation seems to break my WebView and i don’t understand why.

The code is pretty simple, I have the HTML file in my res/raw directory, here is the code that loads it fine when debugging.

WebView mv = (WebView)findViewById(R.id.webView1);
mv.loadUrl("file:///android_res/raw/wesite.html");

As soon as I create the apk for release, running it through proguard it doesn’t work, i just get the cannot load page.

I haven’t added anything to the proguard config file as yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:37:16+00:00Added an answer on June 10, 2026 at 3:37 am

    Proguard obfuscates directories so if you are looking for android_res/raw it is probably no longer called that!

    You can add rules to the proguard.cfg file in your project that will make it skip certain files. But in this case, moving your raw resource to the assets folder will do the trick.

    The problem is that the Webkit FileLoader will try and load your R$drawable class using reflection. If you do not add any keep rule to your proguard.cfg file that class will be renamed, hence Webkit will not be able to load your resource.
    (Taken from Prevent Proguard to remove specific drawables ).

    This is why Android uses the R class naming system for resources – a uniquie lookup id instead of referencing the files by their location

    By placing the file into the assets folder your are bypassing the R class referencing system and everything should work okay.

    You should move your website.html file into the assets folder and call:

    mv.loadUrl("file:///android_asset/wesite.html");
    

    As is suggested at the link above, it should be possible to add the below rule to your Proguard.cfg file to stop the resources location being obfucated instead:

    -keepclassmembers class **.R$* {
        public static <fields>;
    }
    
    -keep class **.R$*
    

    Bare in mind the obfuscation works the way it does for a reason!

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have various pieces of generated HTML/JS that I load into Activity with WebView#loadDataWithBaseURL.
I have an activity using an xml layout where a WebView is embedded. I
I have a simple WebView-based activity that follows the Hello, WebView example to enable
I'm using a webview on my activity. page is loaded from android_asset: webView.loadUrl(file:///android_asset/htm/main.htm); I
So I have a spinner that needs to populate a WebView using an HTML
I have following code: public class reader extends Activity { WebView mWebView; String mFilename;
I have an activity which is displaying a web page using a WebView. Within
I have a webview that I'm creating in an Activity which is a child
I have an activity with a WebView . I would like to give the
I have a webview which will load from file or from the web. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.