I have modified my app so I can have both debug and production build on single mobile device as separate applications:
android { buildTypes { debug {
applicationIdSuffix ".debug"
resValue 'string', 'app_name', 'LeliMath DEV'
}
I realized that WebView stopped working on loading files located in res/raw folder. I get just simple error file not found. Production build works fine.
WebView webview = new WebView(this);
setContentView(webview);
webview.loadUrl("file:///android_res/raw/changelog.html");
Android monitor says:
AndroidProtocolHandler: Unable to open resource URL: file:///android_res/raw/changelog.html
java.lang.ClassNotFoundException:
Didn't find class "lelisoft.com.lelimath.debug.R$raw" on path:
DexPathList[[zip file "/data/app/lelisoft.com.lelimath.debug-1/base.apk"],
nativeLibraryDirectories=[/data/app/lelisoft.com.lelimath.debug-1/lib/arm64,
/system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
You could try these steps:
R.java file under different flavor directory. In your case create this file inside this package lelisoft.com.lelimath.debug inside your debug flavor directory.R.java content or just pick what do you need and set it with the value from your normal R.java.
For example:package lelisoft.com.lelimath.debug;
public final class R {
public static final class raw {
public static final String changelog = lelisoft.com.lelimath.R.raw.changelog;
}
}
-keep class lelisoft.com.lelimath.debug.R$raw {*;}
You could repeat those steps to any flavor you have. Hope it fix your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With