guardian / toolargetool

A tool to help you debug TransactionTooLargeExceptions on Android 7+
MIT License
1.13k stars 105 forks source link

Library doesn't support JAVA only application? #29

Open Eyadoos opened 5 years ago

Eyadoos commented 5 years ago

I came across your library while searching for a solution for Transaction Too Large exception, I added the library as a dependency and added the starlogging method in application class but now the app refuses to open and crashes on each run saying:

java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; at com.gu.toolargetool.TooLargeTool.startLogging(Unknown Source:2) at com.gu.toolargetool.TooLargeTool.startLogging$default(TooLargeTool.kt:89) at com.gu.toolargetool.TooLargeTool.startLogging(Unknown Source:3) at com.mytheresa.app.mytheresa.app.MythApplication.onCreate(MythApplication.java:80) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1122) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6517) at android.app.ActivityThread.-wrap2(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1963) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7425) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/base.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_resources_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.gu.toolargetool.TooLargeTool.startLogging(Unknown Source:2)  at com.gu.toolargetool.TooLargeTool.startLogging$default(TooLargeTool.kt:89)  at com.gu.toolargetool.TooLargeTool.startLogging(Unknown Source:3)  at com.mytheresa.app.mytheresa.app.MythApplication.onCreate(MythApplication.java:80)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1122)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6517)  at android.app.ActivityThread.-wrap2(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1963)  at android.os.Handler.dispatchMessage(Handler.java:108)  at android.os.Looper.loop(Looper.java:166)  at android.app.ActivityThread.main(ActivityThread.java:7425)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)  Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.mytheresa.app.mytheresa.debug-uMfWxQLpaIfjBZ034cV8YA==/split_lib_resources_apk.apk at dalvik.system.DexFile.openDexFileNative(Native Method) at dalvik.system.DexFile.openDexFile(DexFile.java:353) at dalvik.system.DexFile.<init>(DexFile.java:100) at dalvik.system.DexFile.<init>(DexFile.java:74) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337) at dalvik.system.DexPathList.<init>(DexPathList.java:157) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64) at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:75) at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38) 2019-07-11 13:25:39.232 16997-16997/com.mytheresa.app.mytheresa.debug E/AndroidRuntime: at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:716) at android.app.LoadedApk.getClassLoader(LoadedApk.java:749) at android.app.LoadedApk.getResources(LoadedApk.java:996) at android.app.ContextImpl.createAppContext(ContextImpl.java:2489) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6398)

Any suggestions? Must I add configuration for Kotlin inside the project in order to be able to use the library? Thanks in advance.

ilyalyo commented 5 years ago

Have the same problem

ilyalyo commented 5 years ago

Had to downgrade: implementation` 'com.gu.android:toolargetool:0.1.6@aar'

dmarkowski commented 5 years ago

Have the same problem. Downgrade to 0.1.6 works for me.

TFreudi1 commented 5 years ago

Same thing here, maybe you make a toolargetool_j as Java version ?

sacrificium-dev commented 4 years ago

I have to use 0.1.6 in a Java-only envirionment too, but the sum of the parcel size does not work, it's always 0.0KB. Here is a little example:

XyzFragment.onSaveInstanceState wrote: Bundle24207617 contains 14 keys and measures 0.0 KB when serialized as a Parcel

But by the way: a great, intuitive tool. I would appreciate when it supports Java-only applications with a new version.

slothkey commented 4 years ago

I have to use 0.1.6 in a Java-only envirionment too, but the sum of the parcel size does not work, it's always 0.0KB. Here is a little example:

XyzFragment.onSaveInstanceState wrote: Bundle24207617 contains 14 keys and measures 0.0 KB when serialized as a Parcel

  • ARGUMENT_OBJECT_1 = 0.1 KB
  • ARGUMENT_OBJECT_2 = 1.8 KB
  • ARGUMENT_OBJECT_3 = 0.1 KB

But by the way: a great, intuitive tool. I would appreciate when it supports Java-only applications with a new version.

single is right (like ARGUMENT_OBJECT_1),sum is 0KB. Because there is a bug in TooLargeTool.java sizeTreeFromBundle(): bundle.remove() ,so in the end, bundle is empty, so is 0KB

maxspencer commented 3 years ago

Please try upgrading to 0.3.0, I believe I've addressed this problem.

jlr-frameo commented 3 years ago

Hi, just FYI using 0.1.6 is still a requirement for running in a Java Android project, version 0.3.0 does not seem to have fixed this issue. However 0.1.6 looks to be working fine (besides the mentioned bug in the logging), and it help me debug a difficult problem, so thanks :)

maxspencer commented 3 years ago

@jlr-frameo

Ah I'm sorry to hear that it's still not working for Java-only projects, if you have any details to share that might help me (or someone else) debug that issue (build errors etc.) then please share them on this issue.

Glad you were able to fix your problem though :+1:

jlr-frameo commented 3 years ago

I got the same error as the original post here, i.e. java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics - I'd assume that this will happen for any Android project that has been created without any Kotlin support. But I suppose it could be that there are other aspects of an older Java Android project that affects the outcome.