Fixed
Status Update
Comments
uc...@google.com <uc...@google.com>
xa...@google.com <xa...@google.com> #2
Can you provide information about which proguard rules you are using? it's showing that it obfuscated a view (android.view.x) which is not something you should be doing.
(Michal, I'm wondering if we should have some built-in rules for this.)
(Michal, I'm wondering if we should have some built-in rules for this.)
m4...@gmail.com <m4...@gmail.com> #3
Just the default proguard rules, you can reproduce this error by creating new android studio project with "Empty" template.
be...@google.com <be...@google.com> #4
I was unable to reproduce it in beta 6. I created a new project, chose the "Empty activity" template and added this to build.gradle:
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Do you have some other repro steps? Do you have Instant Run enabled?
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Do you have some other repro steps? Do you have Instant Run enabled?
m4...@gmail.com <m4...@gmail.com> #5
so i did some research on this problem because i think you guys didn't really pay attention on thin one.
1. I've tested this on a mac computer but there is no problem with it, and i think it's just with windows computers.
2. Also I've notice that if you delete build and app>build directories and run the app again the problem will gone on windows computers, so i think there is some problems with gradle's first build or something like that.
3. Before deleting those directories the app size is around 700KB but after deleting those directories for a clean build the app size will grow to around 800KB.
4. I've attached two apks one with problem (before clean build) and one without the problem (after clean build).
5. Also I've attached a video please watch it.
1. I've tested this on a mac computer but there is no problem with it, and i think it's just with windows computers.
2. Also I've notice that if you delete build and app>build directories and run the app again the problem will gone on windows computers, so i think there is some problems with gradle's first build or something like that.
3. Before deleting those directories the app size is around 700KB but after deleting those directories for a clean build the app size will grow to around 800KB.
4. I've attached two apks one with problem (before clean build) and one without the problem (after clean build).
5. Also I've attached a video please watch it.
cm...@google.com <cm...@google.com> #6
The attempt to inflate android.view.x is the resource shrinker shrinking away a layout that is used, as it replaces XML files it considers unreachable with <?xml version="1.0" encoding="utf-8"?><x />
So this sounds like an bug in the resource shrinker or its integration.
So this sounds like an bug in the resource shrinker or its integration.
hu...@google.com <hu...@google.com> #7
Thanks a lot for the video, it makes it so much easier to reproduce the issue.
This is not a Windows problem, it happens on my Linux machine too.
Steps to reproduce:
1. Create a new project
2. Configure the debug build type as follows:
buildTypes {
debug {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
3. Run a full build: ./gradlew clean assDeb
4. Change shrinkResources in step 2 above to true
5. Now run an incremental build: ./gradlew assDeb --info
Observe that the MergeResources task does not run:
> Task :app:mergeDebugResources
Putting task artifact state for task ':app:mergeDebugResources' into context took 0.0 secs.
Skipping task ':app:mergeDebugResources' as it is up-to-date (took 0.029 secs).
That means this directory needed for ShrinkResourcesTransform is not generated: /usr/local/google/home/hungnv/Desktop/MyApplication/app/build/intermediates/merged-not-compiled-resources/debug
Therefore, ShrinkResourcesTransform incorrectly strips away stuff that is in use.
The fix is to annotate the merged-not-compiled-resources output directory more properly to trigger a re-run of MergeResources when shrinkResources is changed from disabled to enabled.
This is not a Windows problem, it happens on my Linux machine too.
Steps to reproduce:
1. Create a new project
2. Configure the debug build type as follows:
buildTypes {
debug {
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
3. Run a full build: ./gradlew clean assDeb
4. Change shrinkResources in step 2 above to true
5. Now run an incremental build: ./gradlew assDeb --info
Observe that the MergeResources task does not run:
> Task :app:mergeDebugResources
Putting task artifact state for task ':app:mergeDebugResources' into context took 0.0 secs.
Skipping task ':app:mergeDebugResources' as it is up-to-date (took 0.029 secs).
That means this directory needed for ShrinkResourcesTransform is not generated: /usr/local/google/home/hungnv/Desktop/MyApplication/app/build/intermediates/merged-not-compiled-resources/debug
Therefore, ShrinkResourcesTransform incorrectly strips away stuff that is in use.
The fix is to annotate the merged-not-compiled-resources output directory more properly to trigger a re-run of MergeResources when shrinkResources is changed from disabled to enabled.
hu...@google.com <hu...@google.com>
hu...@google.com <hu...@google.com> #8
Thank you for this report! The issue will be fixed in 3.0 Beta 8 / RC 1.
Change-Id: Ic673c0734869fd158a6c90acd48a38d5dc9f4c57
Change-Id: Ic673c0734869fd158a6c90acd48a38d5dc9f4c57
Description
Version of Gradle Plugin: 3.0.0-beta6
Version of Gradle: 4.1
Version of Java: 1.8.0_92
OS: Windows 10
Steps to Reproduce:
1. Set minify and shrinkResources to enable mode (true).
2. Run the project.
3. And get this beautiful red colored error :
Didn't find class "android.view.x" on path: DexPathList[[zip file "/data/app/com.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapplication-1/lib/x86, /system/lib, /vendor/lib]]