Status Update
Comments
ji...@gmail.com <ji...@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.
mk...@google.com <mk...@google.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...
ji...@gmail.com <ji...@gmail.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
ji...@gmail.com <ji...@gmail.com> #5 Restricted
ji...@gmail.com <ji...@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"
mk...@google.com <mk...@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)
ji...@gmail.com <ji...@gmail.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'
}
}
ap...@google.com <ap...@google.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.
ap...@google.com <ap...@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?
ap...@google.com <ap...@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.
ap...@google.com <ap...@google.com> #12
Thanks!
ap...@google.com <ap...@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
ap...@google.com <ap...@google.com> #14
Thanks for looking into it!
I agree it's strange they have an implementation
dependency on junit, and I'm glad they're removing it in okhttp 5+.
I'll go ahead and close this bug for now.
ap...@google.com <ap...@google.com> #15
This is fixed by Change-Id: I12ec8785cd4dbb6e523c66b4620ed2388f448822, which will be in AGP 7.4.0-rc01 and 8.0.0-alpha08.
ap...@google.com <ap...@google.com> #16
Thanks for filing the bug, OP. Your observation in
ji...@gmail.com <ji...@gmail.com> #17
FUCK YEAH! Glad I was helpful! Appreciate you working through it with me here. Cheers. Once I update to alpha08 I will remove the workaround I added. cheers
mk...@google.com <mk...@google.com> #18
Great to hear and thank you for filing a bug.
ma...@gmail.com <ma...@gmail.com> #19
گ
Description
java.lang.ClassCastException: sg.bigo.live.ppi cannot be cast to sg.bigo.live.asd
at sg.bigo.live.c7q.get(Unknown Source:2)
at sg.bigo.live.xka.d(Unknown Source:11)
at sg.bigo.live.kka.u(Unknown Source:8)
at com.yy.iheima.startup.SplashAdvertView.onAttachedToWindow(SplashAdvertView.java:17)
at android.view.View.dispatchAttachedToWindow(View.java:20894)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3539)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3546)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2799)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2305)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9133)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1232)
at android.view.Choreographer.doCallbacks(Choreographer.java:1029)
at android.view.Choreographer.doFrame(Choreographer.java:934)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1217)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8212)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
jadx disassemble result:
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Base64;
import com.google.android.gms.internal.p001firebaseauthapi.zzwe;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import sg.bigo.live.t8l;
/* loaded from: classes.dex */
public class c7q implements asd, etr {
public static volatile c7q y;
public Object z;
public /* synthetic */ c7q(Context context) {
this.z = new HashMap();
this.z = context;
}
public /* synthetic */ c7q(Object obj, Object obj2) {
this.z = obj;
this.z = obj2;
}
public /* synthetic */ c7q(String str) {
this.z = new Intent();
this.z = str;
}
public /* synthetic */ c7q(asd asdVar, esd esdVar) {
this.z = asdVar;
this.z = esdVar;
}
public static c7q z(Context context) {
if (context == null) {
nwp.e("[TinyDataManager]:mContext is null, TinyDataManager.getInstance(Context) failed.");
return null;
}
if (y == null) {
synchronized (c7q.class) {
if (y == null) {
y = new c7q(context);
}
}
}
return y;
}
public void a(Context context) {
Class<?> x = t8l.y.z.x((String) this.z);
if (x != null) {
((Intent) this.z).setClass(context, x);
Intent intent = (Intent) this.z;
if (intent == null || intent.getComponent() == null) {
return;
}
Class[] l0 = qc.l0(x);
if (l0 != null && l0.length != 0) {
qc.I(intent);
if (context instanceof p17) {
new sg.bigo.mobile.android.srouter.api.interceptor.y(context, x, intent, -1).z();
return;
}
qc.g1(intent);
}
qc.v1(context, intent, -1, x);
}
}
public void b(Activity activity, int i) {
Class<?> x = t8l.y.z.x((String) this.z);
if (x != null) {
((Intent) this.z).setClass(activity, x);
Intent intent = (Intent) this.z;
if (intent == null || intent.getComponent() == null) {
return;
}
Class[] l0 = qc.l0(x);
if (l0 != null && l0.length != 0) {
qc.I(intent);
if (activity instanceof p17) {
new sg.bigo.mobile.android.srouter.api.interceptor.y(activity, x, intent, i).z();
return;
}
qc.g1(intent);
}
qc.v1(activity, intent, i, x);
}
}
@Override // sg.bigo.live.asd
public ft2 get(Object obj) {
ft2 ft2Var = ((asd) this.z).get(obj);
if (ft2Var == null) {
((esd) this.z).p();
} else {
((esd) this.z).c(obj);
}
return ft2Var;
}
public boolean u(
if (TextUtils.isEmpty(str)) {
nwp.w("pkgName is null or empty, upload ClientUploadDataItem failed.");
return false;
} else if (yyp.v(hnVar, false)) {
return false;
} else {
if (TextUtils.isEmpty(hnVar.d())) {
hnVar.f(yyp.y());
}
hnVar.g(str);
ozp.z((Context) this.z, hnVar);
return true;
}
}
@Override // sg.bigo.live.asd
public boolean v(rsh rshVar) {
return ((asd) this.z).v(rshVar);
}
@Override // sg.bigo.live.asd
public ft2 w(Object obj, ft2 ft2Var) {
((esd) this.z).k();
return ((asd) this.z).w(obj, ft2Var);
}
@Override // sg.bigo.live.etr
public void x(Object obj) {
bur burVar = (bur) obj;
String str = burVar.z;
msh.u(str);
List i = new com.google.android.gms.internal.p001firebaseauthapi.y(new du1(new kbr())).i(str);
if (i.size() < 2) {
throw new RuntimeException("Invalid idToken ".concat(str));
}
String str2 = (String) i.get(1);
try {
uur z = uur.z(new String(str2 == null ? null : Base64.decode(str2, 11), "UTF-8"));
zzwe zzweVar = new zzwe(burVar.y, burVar.z, Long.valueOf(z.y.longValue() - z.z.longValue()), "Bearer");
Object obj2 = this.z;
jqr.a((jqr) obj2, zzweVar, null, Boolean.FALSE, (b3r) obj2, this);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unable to decode token", e);
}
}
@Override // sg.bigo.live.asd
public int y(rsh rshVar) {
return ((asd) this.z).y(rshVar);
}
@Override // sg.bigo.live.etr
public void zza(String str) {
((b3r) this.z).y(xoq.z(str));
}
}