-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeToken must be created with a type argument: new TypeToken<...>() {}; When using code shrinkers (ProGuard, R8, ...) make sure that generic signatures are preserved. #117
Comments
hi @SergiOnGit!
No, you don't have to. |
@SergiOnGit what rules do you currently have in the proguard config? |
@vladd-g I had -keep class com.adapty.** { *; } in proguard, Then I removed it and fixed with android.enableR8.fullMode=false in gradle.properties. But what is correct solution? I don't want to have ui lib installed. Also you don't mention anything in docs about proguard. Guide me please. |
Do you mean it works well now?
You can simply remove the
Actually, only |
Yes it works now. So I can remove ui module and should add -keep class com.adapty.** { *; } rule to proguard. And should leave full mode disabled right? Would be great if you add all the necessary info in docs. Also cases where app may still crash with possible fix. |
If everything works fine, why not |
@vladd-g I added -keep class com.adapty.** { *; } and removed ui lib. Also leave full mode disabled and now build fails. See the log:
|
@SergiOnGit please try adding |
-dontwarn com.adapty.ui.** made it work, But only after I removed -keep class com.adapty.** { *; } Also, I know you have mentioned in docs to add multidex true but I removed it and it still works. Should I expect errors on some stage with disabled multidex? |
What was the error before you removed it?
If it compiled with success, you don't need it Unlike obfuscation issues that can occur at runtime, so I'd try keeping |
I managed to figure it out. This two rule together
Works when I removed android.enableR8.fullMode=false Also no need to install ui lib. Looks like, it just needed correct proguard rules. App builds and starts. |
Looks like I made a mistake, android.enableR8.fullMode=false is still needed, without it app startup ends with error:
|
What error did you see before removing |
I don't clearly understand what you mean before removing, I I don't remove it, there is no error app works with this configs:
But I noticed that disabling full mode increases app size dramatically, 21mb app download size is 56mb on play store. Can you fix it for full mode? Without it, app starts at startup with this log:
Let me know if you need any additional info. |
Could you please try adding these rules? (If they are not sufficient for correct functioning, also add these) |
@vladd-g Checked. These rules made it work without disabling full mode
|
@SergiOnGit, so now everything works fine? |
@vladd-g Sorry for late reply. Yes, everything works fine. |
Description
App crashes on production and firebase logs this error:
Fatal Exception: java.lang.IllegalStateException: TypeToken must be created with a type argument: new TypeToken<...>() {}; When using code shrinkers (ProGuard, R8, ...) make sure that generic signatures are preserved. at com.google.gson.reflect.TypeToken.getTypeTokenTypeArgument(TypeToken.java:100) at com.google.gson.reflect.TypeToken.<init>(TypeToken.java:70) at com.adapty.internal.di.Dependencies$init$1$1.<init>(Dependencies.kt:137) at com.adapty.internal.di.Dependencies$init$1.invoke(Dependencies.kt:137) at com.adapty.internal.di.Dependencies$init$1.invoke(Dependencies.kt:56) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$17.invoke(Dependencies.kt:287) at com.adapty.internal.di.Dependencies$init$17.invoke(Dependencies.kt:286) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$15.invoke(Dependencies.kt:272) at com.adapty.internal.di.Dependencies$init$15.invoke(Dependencies.kt:270) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$7.invoke(Dependencies.kt:217) at com.adapty.internal.di.Dependencies$init$7.invoke(Dependencies.kt:214) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$5.invoke(Dependencies.kt:200) at com.adapty.internal.di.Dependencies$init$5.invoke(Dependencies.kt:198) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$47.invoke(Dependencies.kt:446) at com.adapty.internal.di.Dependencies$init$47.invoke(Dependencies.kt:444) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.internal.di.Dependencies$init$48.invoke(Dependencies.kt:458) at com.adapty.internal.di.Dependencies$init$48.invoke(Dependencies.kt:456) at com.adapty.internal.di.DIObject.provide(DIObject.kt:19) at com.adapty.internal.di.Dependencies.injectInternal$default(Dependencies.java:35) at com.adapty.Adapty$special$$inlined$inject$adapty_release$default$1.invoke(Dependencies.kt:31) at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81) at com.adapty.Adapty.<clinit>(Adapty.kt:500) at com.adapty.Adapty.getAdaptyInternal(Adapty.kt:500) at com.adapty.Adapty.init(Adapty.kt:520) at com.adapty.Adapty.activate(Adapty.kt:64) at com.adapty.react.AdaptyCallHandler.handleActivate$lambda$1(AdaptyCallHandler.kt:64) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7680) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:423) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
At first, I could even build in production mode, I tried playing with proguard rules but no luck, then installed @adapty/react-native-ui lib and build went soccessfully, It is really bad that we have to install @adapty/react-native-ui even if we don't use it. Also docs doesn't say anything about it. After this I tried to open app, but crashed at startup.
Version
v2.10.0
What platforms are you seeing the problem on?
Android
System info
The text was updated successfully, but these errors were encountered: