Obsolete
Status Update
Comments
ar...@google.com <ar...@google.com> #2
Same here. I have links in a local html file referencing file:///android_res/drawable/ and on all gradle build flavors using another applicationId (added suffix) the Webview only shows broken links.
This behaviour seems not to be connected solely to Android 5.0 since it occurs on Android 4.4.4 too (tested with current cyanogenmod 11 build).
This behaviour seems not to be connected solely to Android 5.0 since it occurs on Android 4.4.4 too (tested with current cyanogenmod 11 build).
ar...@google.com <ar...@google.com> #3
As a hotfix I added the following code to the gradle buildscript, which generates an additional R.java with changed java package for every flavor. I don't like this solution though.
android.applicationVariants.all{ variant ->
variant.javaCompile.doFirst{
copy {
from "${buildDir}/generated/source/r/${variant.dirName}/com/example/application/R.java"
into "${buildDir}/generated/source/r/${variant.dirName}/com/example/application/${variant.buildType.name }/"
}
File rFile = file("${buildDir}/generated/source/r/${variant.dirName}/com/example/application/${variant.buildType.name }/R.java")
String content = rFile.getText('UTF-8')
String newPackageName = "com.example.application.${variant.buildType.name }";
content = content.replaceAll(/com.example.application/, newPackageName)
rFile.write(content, 'UTF-8')
}
}
android.applicationVariants.all{ variant ->
variant.javaCompile.doFirst{
copy {
from "${buildDir}/generated/source/r/${variant.dirName}/com/example/application/R.java"
into "${buildDir}/generated/source/r/${variant.dirName}/com/example/application/${
}
File rFile = file("${buildDir}/generated/source/r/${variant.dirName}/com/example/application/${
String content = rFile.getText('UTF-8')
String newPackageName = "com.example.application.${
content = content.replaceAll(/com.example.application/, newPackageName)
rFile.write(content, 'UTF-8')
}
}
io...@gmail.com <io...@gmail.com> #4
I've recenly encountered this issue and I must say it's quite a nuisance. Searched half of the Internet just to find out that the problem lies in Gradle's applicationIdSuffix :). I think this bug should be reported to Android SDK Build Tools devs, because only they can do something about it.
ar...@google.com <ar...@google.com> #5
IMHO it's the case of Android platform problem. Resources are packed, WebView tries to load them from wrong place. It's not build tools that put them in wrong place.
And by the way it's very frustrating bug.
And by the way it's very frustrating bug.
wi...@gmail.com <wi...@gmail.com> #6
[Comment deleted]
Description
Use vector icons from this folder
in selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="
<item android:state_enabled="false" android:drawable="@drawable/ic_switch_loop_camera_disabled"/>
<item android:drawable="@drawable/ic_switch_loop_camera"/>
</selector>
Then use in ImageView:
<ImageView
android:id="@+id/button_switch_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_switch_loop_camera_selector"/>
and try to change view enabled state.
2. What happened:
On android API v21-23 icon is corrupted (see screenshot in attach - 2017-06-16_14-30_Android Emulator.jpg). On other versions (for example 4.4 and 7.1.2) there are no any problems with this icons. One intresting thing - if I use icons separately without selector it shows normally on all API versions (see another screenshot is attach - 2017-06-16_14-40_Android Emulator.jpg).
3. Normal behaviour:
Should display normally with selector on all API versions
Environment:
minSdkVersion - 19
targetSdkVersion - 25
compileSdkVersion - 25
support library version - 25.3.1
gradle plugin version - 2.3.3