Comments (18)
hi @SergiOnGit!
It is really bad that we have to install @adapty/react-native-ui even if we don't use it
No, you don't have to.
from adaptysdk-react-native.
@SergiOnGit what rules do you currently have in the proguard config?
from adaptysdk-react-native.
@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.
from adaptysdk-react-native.
Then I removed it and fixed with android.enableR8.fullMode=false
Do you mean it works well now?
I don't want to have ui lib installed
You can simply remove the @adapty/react-native-ui
dependency if you don't use the Paywall Builder feature
I don't want to have ui lib installed. Also you don't mention anything in docs about proguard.
Actually, only -keep class com.adapty.** { *; }
is sufficient in most cases. If disabling full mode prevented obfuscation-related crashes, that's okay too. We'll check and add all the necessary info to the docs if anything is missing. Thank you!
from adaptysdk-react-native.
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.
from adaptysdk-react-native.
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?
If everything works fine, why not
from adaptysdk-react-native.
@vladd-g I added -keep class com.adapty.** { *; } and removed ui lib. Also leave full mode disabled and now build fails. See the log:
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/warlock/Desktop/Mobile/movebody/android/app/build/outputs/mapping/release/missing_rules.txt. ERROR: R8: Missing class com.adapty.ui.AdaptyUI$Action$Close (referenced from: void com.adapty.internal.crossplatform.AdaptyUIActionTypeAdapterFactory$create$result$1.write(com.google.gson.stream.JsonWriter, com.adapty.ui.AdaptyUI$Action)) Missing class com.adapty.ui.AdaptyUI$Action$Custom (referenced from: void com.adapty.internal.crossplatform.AdaptyUIActionTypeAdapterFactory$create$result$1.write(com.google.gson.stream.JsonWriter, com.adapty.ui.AdaptyUI$Action)) Missing class com.adapty.ui.AdaptyUI$Action$OpenUrl (referenced from: void com.adapty.internal.crossplatform.AdaptyUIActionTypeAdapterFactory$create$result$1.write(com.google.gson.stream.JsonWriter, com.adapty.ui.AdaptyUI$Action)) Missing class com.adapty.ui.AdaptyUI$Action (referenced from: com.adapty.ui.AdaptyUI$Action com.adapty.internal.crossplatform.AdaptyUIActionTypeAdapterFactory$create$result$1.read(com.google.gson.stream.JsonReader) and 3 other contexts)
from adaptysdk-react-native.
@SergiOnGit please try adding -dontwarn com.adapty.ui.**
to the proguard rules
from adaptysdk-react-native.
-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?
from adaptysdk-react-native.
But only after I removed -keep class com.adapty.** { *; }
What was the error before you removed it?
Should I expect errors on some stage with disabled multidex?
If it compiled with success, you don't need it
Unlike obfuscation issues that can occur at runtime, so I'd try keeping -keep class com.adapty.** { *; }
from adaptysdk-react-native.
I managed to figure it out. This two rule together
-keep class com.adapty.** { *; } -dontwarn com.adapty.ui.**
Works when I removed android.enableR8.fullMode=false
No matter if you enable multidex or not.
Also no need to install ui lib. Looks like, it just needed correct proguard rules. App builds and starts.
from adaptysdk-react-native.
Looks like I made a mistake, android.enableR8.fullMode=false is still needed, without it app startup ends with 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)...
from adaptysdk-react-native.
This two rule together
-keep class com.adapty.** { *; } -dontwarn com.adapty.ui.**
Works when I removed android.enableR8.fullMode=false
What error did you see before removing android.enableR8.fullMode=false
?
from adaptysdk-react-native.
This two rule together
-keep class com.adapty.** { *; } -dontwarn com.adapty.ui.**
Works when I removed android.enableR8.fullMode=falseWhat error did you see before removing
android.enableR8.fullMode=false
?
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:
-keep class com.adapty.** { *; }
-dontwarn com.adapty.ui.**
android.enableR8.fullMode=false
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:
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)...
Let me know if you need any additional info.
from adaptysdk-react-native.
Could you please try adding these rules? (If they are not sufficient for correct functioning, also add these)
from adaptysdk-react-native.
@vladd-g Checked. These rules made it work without disabling full mode
-keep class com.adapty.** { *; }
-dontwarn com.adapty.ui.**
-keepattributes Signature
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
from adaptysdk-react-native.
@SergiOnGit, so now everything works fine?
from adaptysdk-react-native.
@vladd-g Sorry for late reply. Yes, everything works fine.
from adaptysdk-react-native.
Related Issues (20)
- IOS Introductory Offers and Promotional Offers
- Functionalities not working in release mode HOT 43
- FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-adapty:compileDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction > Compilation error. See log for more details HOT 3
- Attempt to invoke virtual method 'java.lang.String com.google.gson..JsonElement.getAsString()' on a null object reference HOT 8
- (encodingFailed): Failed to find encoder for property "customerUserId"
- Calling adapty.identify(id) inserts last purchase record
- `adapty.activate()` function crashes the app when API key is invalid HOT 1
- Adapty prompts to sign in with Apple ID HOT 1
- iOS build fail HOT 8
- Firebase v19 and Adapty v2.9.6 Conflicts on Android HOT 2
- Android Missing PurchaseToken in AdaptyProfile
- Expo EAS Android build failure: Could not find io.adapty.internal:crossplatform:2.10.3 HOT 5
- Code not executed after call the adapty.makePurchase method HOT 11
- Does the example in the repo still work? HOT 1
- Can't build in dev mode: Could not find io.adapty.internal:crossplatform-ui:2.1.1. & Could not find io.adapty.internal:crossplatform:2.10.3. HOT 2
- 'nil' requires a contextual type HOT 3
- ios issue : we should not see keyboard above the paywall HOT 2
- [IOS 17] requestSubscripition infinite loop HOT 3
- [IOS] Error while fetching paywall products on real device and emulator HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adaptysdk-react-native.