Status Update
Comments
li...@gmail.com <li...@gmail.com> #2
Okay. I tried a bunch of agp+android studio versions
The last working version was classpath("com.android.tools.build:gradle:7.4.0-alpha06")
once I moved to
classpath("com.android.tools.build:gradle:7.4.0-alpha07")
then things start breaking on firebase app dist.
ch...@google.com <ch...@google.com>
li...@gmail.com <li...@gmail.com> #3
Scott, assigning to you as it seem to complain the zip is not aligned while packaging which is very puzzling considering the steps...
je...@google.com <je...@google.com>
sp...@google.com <sp...@google.com> #4
OP, when you build the APK with AGP, are you doing any post-processing on the APK and/or do you have any custom tasks that are modifying the APK?
Can you try to verify the alignment of your APK with zipalign
locally (zipalign
is included in build-tools
):
zipalign -c -v 4 foo.apk
ra...@google.com <ra...@google.com>
pa...@google.com <pa...@google.com>
pa...@google.com <pa...@google.com> #5
Not doing any post processing. No custom tasks. I will try to verify alignment now. Give me a sec.
li...@gmail.com <li...@gmail.com> #6
Scenario 1:
built my apk with agp alpha09, but didn't update firebase (bom = 30.2.0)
/Users/idle/Library/Android/sdk/build-tools/31.0.0/zipalign -c -v 4 app-release.apk
"Verification succesful"
Scenario 2:
built my apk with agp alpha09, but I DID update firebase (bom = 30.3.1)
/Users/idle/Library/Android/sdk/build-tools/31.0.0/zipalign -c -v 4 app-release.apk
"Verification FAILED"
pa...@google.com <pa...@google.com> #7
Scenario 3:
built my apk with agp alpha09, with androidx.splash rc01
/Users/idle/Library/Android/sdk/build-tools/31.0.0/zipalign -c -v 4 app-release.apk
"Verification succesful"
Scenario 4:
built my apk with agp alpha09, with androidx.splash 1.0.0
/Users/idle/Library/Android/sdk/build-tools/31.0.0/zipalign -c -v 4 app-release.apk
"Verification FAILED"
In both failed cases if I do | grep BAD
I get
7216334 junit/runner/logo.gif (BAD - 2)
7217354 junit/runner/smalllogo.gif (BAD - 2)
pa...@google.com <pa...@google.com> #8
In the cases where zipalign
verification fails, is the APK generated by a clean build (e.g., ./gradlew clean :app:assembleRelease
)?
Does verification succeed if you add this to your build.gradle?
android {
packagingOptions {
exclude 'junit/runner/logo.gif'
exclude 'junit/runner/smalllogo.gif'
}
}
li...@gmail.com <li...@gmail.com> #9
In the cases where zipalign verification fails, is the APK generated by a clean build (e.g., ./gradlew clean :app:assembleRelease)?
I clean before i generate the apk using the Android Studio menu for generating an apk
Does verification succeed if you add this to your build.gradle?
I assume it will, but let me try. Any reason why changing from androidx.splash 1.0.0-rc01 to 1.0.0 stable (which is 0 changes. all it changed was the dependency version) that it fails verification. It seems like something else is wrong that's a bit deeper than just adding these two exclude statements.
sa...@google.com <sa...@google.com> #10
It seems like something else is wrong that's a bit deeper than just adding these two exclude statements.
I agree, but I'd like to find a workaround for you in the meantime.
I think I'll probably need a repro project to get to the bottom of it. In your other thread, it sounded like you weren't able to create a repro project... any luck since then?
sa...@google.com <sa...@google.com> #11
I was not able to create a repro unfortunately. As soon as I started to prune things out of my project it started to succeed.
Similarly. firebase came out with a new version. and if i use that new version... then it also succeeds. 🤯
I'm glad to hear there is a workaround for now (and i learned something new about zipalign). I will try to create a repo project again later today when I have about an hour or so free to play around with it, but for now I will just commit the
android {
packagingOptions {
exclude 'junit/runner/logo.gif'
exclude 'junit/runner/smalllogo.gif'
}
}
to my codebase because that did the trick for me. Everything works. Thank you for your quick response and helpful debugging steps.
li...@gmail.com <li...@gmail.com> #12
Thanks!
pa...@google.com <pa...@google.com>
pa...@google.com <pa...@google.com> #13
not able to get a repro case. literally any minor thing i change makes this verify successfully. im a bit out of ideas. the only thing i can think of that might help is why is junit being packaged into my app.
and i think the reason for that is that I depend on okhttp3:mockwebserver:4.10.0
implementation("junit:junit:4.13.2") // Needed because mockwebserver has a dependency on it. This can be removed in okhttp 5+
so the apps i ship through firebase have a mockwebserver using okhttpmockwebserver, but version 4+ requires junit while okhttp 5+ (not yet released), removes this dep.
so maybe just playing around with adding junit as a dependency to an actual app might help repro?
source:
maybe still owrth checking out as there could be other deps that end up with the same issue. idk. just trying to be helpful i guess. but as for me. im going to consider this case closed. excluding the above like you mentioned has unblocked my team. cheers
li...@gmail.com <li...@gmail.com> #14
li...@gmail.com <li...@gmail.com> #15
This is fixed by Change-Id: I12ec8785cd4dbb6e523c66b4620ed2388f448822, which will be in AGP 7.4.0-rc01 and 8.0.0-alpha08.
Description
DESCRIBE THE ISSUE IN DETAIL:
STEPS TO REPRODUCE:
./gradlew :app:lintDebug
and observe 2 issues;./gradlew :lint-checks:test
and observe tests failing.It looks like
PartialResult#map
doesn't follow the contract in unit tests. It claims to returnLintMap
for the project in context, but under the certain condition it seems to be violated.The conditions require multimodule setup. A
library
module must put smth into itsLintMap
. Then, when theapp
module accesses its ownLintMap
for the first time it get a map prefilled with the data from thelibrary
module, instead of the fresh one.To demonstrate the issue I created the following setup:
:app
module and a:library
module;:app
module containsapp_color
color resource, while:library
module contains:library_color
;color
resource declaration within the module, puts into the partial results and then reports all colors found per module incheckPartialResults
method;If you run lint checks using the
./gradlew :app:lintDebug
command, you'll observe Lint correctly reportingapp_color
found in:app
andlibrary_color
found in:library
. However, if you run the unit tests, you'll observe that Lint also reports alibrary_color
found in the:app
.It looks like while scanning the
:app
module, the first access to partial results, causesLintCliClient
to create new instance of results and fill it with results of the dependent module (seeLintCliClient#getPartialResults
method). For some reason this is happening only in tests.The replacement of the
getPartialResult.map()
method call withgetPartialResult.mapFor(context.project)
method call successfully addresses the issue.There's still a chance, that my test is wrong. In this case, would be great to know in which way.
Studio Build: Chipmunk | 2021.2.1 Version of Gradle Plugin: 7.2.1, 7.4.0-alpha08 Version of Gradle: 7.4.2 OS: Mac OS Monteray 12.4