Status Update
Comments
ji...@gmail.com <ji...@gmail.com> #2
Lint options:
lintOptions {
lintConfig = file('lint.xml')
abortOnError true
xmlReport true
htmlReport true
checkDependencies true
}
Also, our project has custom lint rules. Failure happens with a dependency of 26.6.3 and 27.0.0.
Is any way to downgrade lint runner? This problem is keeping us from using AGP 4.0
mk...@google.com <mk...@google.com> #3
Attached slightly different stacktrace for the same problem.
Wonder if disabling some lint rules could help to "fix" this problem, as it is also blocking for us 4.0 AGP upgrade.
ji...@gmail.com <ji...@gmail.com> #4
Notes:
I suspect the exceptions are happening now because JetBrains recently changed an assert
statement into a hard failure (see
I.e., it's possible that Lint has been hitting this code path all along, and only now it is causing a problem.
This has been difficult to investigate so far because the failure is nondeterministic and also deep inside the Kotlin compiler. Plus, JetBrains seems to be hitting this code path occasionally too (hence why they changed the assert into a hard failure), so I'm not even sure whether Lint is implicated or not.
ji...@gmail.com <ji...@gmail.com> #5 Restricted
ji...@gmail.com <ji...@gmail.com> #6
Has anyone tried this with 4.1.0-beta2? We're using a more recent version of UAST and the Kotlin compiler there. It's not clear that it's fixed but -- there's a chance :-)
mk...@google.com <mk...@google.com> #7
I tried. The same error. I am wondering, is any way to know which lint checks cause failure? I have a few custom lint checks. Or, is any way downgrade compiler for lint checks?
ji...@gmail.com <ji...@gmail.com> #8
I did more tests and probably narrow down a cause. I did all tests on 4.1.0-beta2
. Original configuration have enabled checkDependencies
and included custom lint checks. Custom lint checks are compiled using 26.6.3
version:
checkDependencies = true, customLintChecks = true
= 20% chance of successcheckDependencies = true, customLintChecks = false
= 57% chance of successcheckDependencies = false, customLintChecks = true
= 100% chance of success
It is a clear evidence that checkDependencies
feature is not stable. In addition, custom lint checks is not friendly with checkDependencies
and increases the risk of failure. Or maybe just an old lint SDK used is to blame.
It is very similar to
I have a theory, but do not know how to test. Maybe crashes happening because there are some lint checks from libs built upon old lint SDK version?
ap...@google.com <ap...@google.com> #9
To me this is happening on 4.2.0-alpha04 too.
Can someone confirm that this is happening if you have these three conditions met?:
- checkDependencies=true on your app module
- have a custom lint rule using lintChecks on your app module
- have a custom lint rule using lintChecks on your library module
For me the error went away after I removed the lintChecks on the library module.
ap...@google.com <ap...@google.com> #10
could you clarify exactly what you mean in these?
have a custom lint rule using lintChecks on your app module have a custom lint rule using lintChecks on your library module
By this I mean a declaration in your modules dependency block:
lintChecks project(":features:language_lint")
ap...@google.com <ap...@google.com> #11
As opposed to lintPublish
? Or is that not relevant?
ap...@google.com <ap...@google.com> #12
For me this is for local checks so I'm using lintChecks. Removing lintChecks from the library module and only applying it on the app module fixed the lint crash. However that's not optimal as I want to run the lint checks individually on the library module as well. It would not be interesting if this is really the cause of the issue or if it doesn't fix it for others.
ap...@google.com <ap...@google.com> #13
I do not have any custom lint checks declared but there might be a transient lint check pulled in.
ap...@google.com <ap...@google.com> #14
We have checkDependencies=true
on our app module and apply there custom lint checks. Disabling custom lint checks has not solved the issue, though we have more custom lint checks via external dependencies (for example, timber).
ap...@google.com <ap...@google.com> #15
#14, could you check with checkDependencies=false
? It fixes problem on my project. Would be nice to hear more proves.
ap...@google.com <ap...@google.com> #16
#15, I've set checkDependencies = false
, but left our custom lint checks enabled. So far lint finished successfully without issue errors.
ji...@gmail.com <ji...@gmail.com> #17
In my case, all builds of the >50 were a success after checkDependencies = false
. However, disabling checkDependencies
is not a solution as well. Since all our code is split in small logical modules, there is no point in lint. Too many false-positives and true-negatives.
mk...@google.com <mk...@google.com> #18
I cherry-picked a change to 4.1 Beta 4 which essentially changes this error into a logged warning rather than a hard failure. That does not "fix" the problem, but it at least gets us back to the behavior of 3.6. Can someone confirm that this workaround has worked for them?
Also, I think I know what the root cause is (see notes below). However, it's hard to be sure without a repro scenario. Would anyone be willing to share an open-source project that reproduces this bug? (You can also send the project to
Notes:
-
My current theory is that this bug is related to
.https://issuetracker.google.com/159733104#comment6
I.e., I think Lint should not be reusing the same Kotlin compiler environment to analyze multiple modules, which is what we do whencheckDependencies=true
. -
It is still strange that the failure is nondeterministic. However, one potential reason is that the Kotlin compiler caches many things via
SoftReference
.
ma...@gmail.com <ma...@gmail.com> #19
Sorry for my long delay. I was tried with 4.1.0-beta05
(newest version to date), and the problem is still here. I added new log in case lines were changed.
Would anyone be willing to share an open-source project that reproduces this bug?
I have only closed source project with this problem. Maybe someone knows some quite large multimodule opensource project I could try setup AGP with lint and try reproduction?
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));
}
}