Giter Club home page Giter Club logo

adaptysdk-android's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

adaptysdk-android's Issues

Error: No virtual method: queryPurchases

I saw an error looking identical #13 , and I have the same issue with Billing Library 4.0.0:

2022-09-02 14:01:07.490 4561-4642/com.xxx.kotlin.yyy E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-7 Process: com.xxx.kotlin.yyyy, PID: 4561 java.lang.NoSuchMethodError: No virtual method queryPurchases(Ljava/lang/String;)Lcom/android/billingclient/api/Purchase$PurchasesResult; in class Lcom/android/billingclient/api/BillingClient; or its super classes (declaration of 'com.android.billingclient.api.BillingClient' appears in /data/app/~~0WjYuDHtimqEOLG92KbSxg==/com.xxx.kotlin.yyy-Hagu0E1CCgHh-5QFGefSTA==/base.apk) at com.adapty.internal.data.cloud.StoreManager.queryInapps(StoreManager.kt:325) at com.adapty.internal.domain.PurchasesInteractor.consumeAndAcknowledgeTheUnprocessed(PurchasesInteractor.kt:140) at com.adapty.internal.AdaptyInternal.executeStartRequests(AdaptyInternal.kt:326) at com.adapty.internal.AdaptyInternal.access$executeStartRequests(AdaptyInternal.kt:26) at com.adapty.internal.AdaptyInternal$activate$1$2.invokeSuspend(AdaptyInternal.kt:133) at com.adapty.internal.AdaptyInternal$activate$1$2.invoke(Unknown Source:10) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit(Errors.kt:158) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62) at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1) at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:14) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelli

In my build.gradle:
implementation 'com.android.billingclient:billing:4.0.0' implementation 'com.github.adaptyteam:AdaptySDK-Android:1.12.0'

This the first application I want to publish, and my very first attempt to integrate Adapty, so it might be some really stupid error. Also the sample app (from here) does not show this error, so I seems to be caused by a different reason.
Thanks!

Billing Client 5.0.0 (latest) support

After updating com.android.billingclient:billing to version 5.0.0 I get an error when activating Adapty.

Executing this:

Adapty.activate(applicationContext, BuildConfig.ADAPTY_PUBLIC_KEY)

Throws the following exception:

E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: <<redacted>>, PID: 15847
    java.lang.NoSuchMethodError: No virtual method queryPurchases(Ljava/lang/String;)Lcom/android/billingclient/api/Purchase$PurchasesResult; in class Lcom/android/billingclient/api/BillingClient; or its super classes (declaration of 'com.android.billingclient.api.BillingClient' appears in /data/app/<<redacted>>/base.apk)
        at com.adapty.internal.data.cloud.StoreManager.queryInapps(StoreManager.kt:325)
        at com.adapty.internal.domain.PurchasesInteractor.consumeAndAcknowledgeTheUnprocessed(PurchasesInteractor.kt:140)
        at com.adapty.internal.AdaptyInternal.executeStartRequests(AdaptyInternal.kt:326)
        at com.adapty.internal.AdaptyInternal.access$executeStartRequests(AdaptyInternal.kt:26)
        at com.adapty.internal.AdaptyInternal$activate$1$2.invokeSuspend(AdaptyInternal.kt:133)
        at com.adapty.internal.AdaptyInternal$activate$1$2.invoke(AdaptyInternal.kt)
        at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Collect.kt:136)
        at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$$inlined$collect$1.emit(Collect.kt:136)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:62)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6123)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

I had to make lots of changes to the billing library's implementation so I guess this new version broke compatibility with older codebase. I assume the same is happening here with Adapty's library.

Promo Codes on Google Play not working for Lifetime products.

I'm having a weird issue and there's no way to contact support, so here I am. When a user redeems a promo code for a lifetime (non-consumable) product, nothing happens. Subscription promo codes work fine. I'm not sure if this is an Adapty issue or Google Play issue. Everything else has been implemented and working fine for months, except lifetime promo codes.

Any insight would be appreciated, thanks!

Crash related to missing WebView

Happens on Adapty init

Reproduced on Android 11, 12, 14
Devices: LGE K51S, Pixel 8 Pro, Galaxy S21 5G, TCL TAB 8 LE
Can also be reproduced on Android emulator with old Android

Fatal Exception: android.util.AndroidRuntimeException: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:398) at android.webkit.WebSettings.getDefaultUserAgent(WebSettings.java:1400) at com.adapty.internal.utils.UserAgentRetriever$retrieveUserAgent$1.invoke(UserAgentRetriever.kt:35) at com.adapty.internal.utils.UserAgentRetriever$retrieveUserAgent$1.invoke(UserAgentRetriever.kt:32) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Crash in release build - TTypeToken must be created with a type argument: new TypeToken<...>() {}; When using code shrinkers (ProGuard, R8, ...) make sure that generic signatures are preserved.

Lib version: 2.10.3

With minify = true and proguard with -keep class com.adapty.** { *; } I encounter this crash:

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 android.app.ActivityThread.handleBindApplication(ActivityThread.java:6764)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
                                                                                                    Caused by: 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 ob.a.<init>(SourceFile:9)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$1$1.<init>(Unknown Source:0)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$1.invoke(SourceFile:25)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$1.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$17.invoke(SourceFile:4)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$17.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$15.invoke(SourceFile:5)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$15.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$7.invoke(SourceFile:7)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$7.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$5.invoke(SourceFile:5)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$5.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$47.invoke(SourceFile:5)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$47.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$48.invoke(SourceFile:5)
                                                                                                    	at com.adapty.internal.di.Dependencies$init$48.invoke(SourceFile:1)
                                                                                                    	at com.adapty.internal.di.DIObject.provide(Unknown Source:26)
                                                                                                    	at com.adapty.Adapty$special$$inlined$inject$adapty_release$default$1.invoke(Unknown Source:23)
                                                                                                    	at ae.o.getValue(Unknown Source:11)
                                                                                                    	at com.adapty.Adapty.getAdaptyInternal(Unknown Source:2)
                                                                                                    	at com.adapty.Adapty.init(Unknown Source:23)
                                                                                                    	at com.adapty.Adapty.activate(SourceFile:16)
                                                                                                    	at com.adapty.Adapty.activate$default(Unknown Source:10)
                                                                                                    	at com.mirecalu.finario.application.FinarioApplication.onCreate(Unknown Source:51)
                                                                                                    	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)

โžก๏ธ I've solved it by adding -keep class com.google.gson.reflect.TypeToken { *; } but I don't understand why I'm the only one having this issue ๐Ÿง

Android Billing Library v5 REQUIRED for all app updates after November 1st

Screenshot_20230526_091013_Brave.jpg

This is not a drill. Adapty must roll out updates for their SDK's ASAP. The worst thing for Adapty would be to try to roll this out last minute and then have some kind of major bug surface after the deadline has already passed. Get this upgrade done now so we can at least roll back to an older version if we have to.

Clock's ticking!

I would like to contribute

Hello,

I like your product and I would like to contribute to it. Where can I start? Any small ticket to start on.

Unable to get paywall with SDK version 2.0.0

I've just updated the Adapty SDK to the latest version 2.0.0 and now I'm unable to get any paywall:

unable to get paywall "xyz"
com.adapty.errors.AdaptyError: Play Market request failed: Google Play In-app Billing API version is less than 3
  at com.adapty.internal.data.cloud.StoreManager$startConnectionSync$$inlined$suspendCancellableCoroutine$lambda$1.onBillingSetupFinished(StoreManager.kt:352)
  at com.android.billingclient.api.zzaj.zzd(com.android.billingclient:billing@@4.1.0:1)
  at com.android.billingclient.api.zzaj.zza(com.android.billingclient:billing@@4.1.0:32)
  at com.android.billingclient.api.zzah.call(Unknown Source:2)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  at java.lang.Thread.run(Thread.java:919)

Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.optString(java.lang.String)' on a null object reference

Hi guys! Please, help me! I am using your library.
After upgrading from version 0.9.3 to 1.4.0 on production, I started getting crash.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.optString(java.lang.String)' on a null object reference
at com.android.billingclient.api.SkuDetails.getPrice(SkuDetails.java:4)
at com.everydoggy.android.presentation.view.fragments.purchase.PurchaseHFragment.processLeftBlockSubscription(PurchaseHFragment.java:3)
at com.everydoggy.android.presentation.view.fragments.purchase.-$$Lambda$PurchaseHFragment$KebSxts6iHh6Z1vGaFVTwikCdJs.onChanged(-.java:3)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:29)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:15)
at androidx.lifecycle.LiveData$ObserverWrapper.activeStateChanged(LiveData.java:23)

It is very similar to this #5.

The field description says that it cannot be null. But based on the crash, it can.
Maybe you could suggest how you can try to fix it?

Thanks

Fatal Exception: kotlin.TypeCastException null cannot be cast to non-null type com.adapty.utils.di.DIObject<T> com.adapty.utils.di.Dependencies.injectInternal

I got the following crash using the latest adapty version 0.9.3
Fatal Exception: kotlin.TypeCastException
null cannot be cast to non-null type com.adapty.utils.di.DIObject
com.adapty.utils.di.Dependencies.injectInternal

com.adapty.utils.di.Dependencies.injectInternal (Dependencies.java:22)
com.adapty.Adapty$$special$$inlined$inject$adapty_release$1.invoke (Adapty.java:60)
kotlin.UnsafeLazyImpl.getValue (UnsafeLazyImpl.java:81)
com.adapty.Adapty$Companion.getPreferenceManager (Adapty.java:6)
com.adapty.Adapty$Companion.access$getGson$p (Adapty.java:32)
com.adapty.Adapty$Companion$apiClientRepository$2.invoke (Adapty.java:48)
com.adapty.Adapty$Companion$apiClientRepository$2.invoke (Adapty.java:32)
kotlin.SynchronizedLazyImpl.getValue (SynchronizedLazyImpl.java:74)
com.adapty.Adapty$Companion.getApiClientRepository (Adapty.java:6)
com.adapty.Adapty$Companion.access$getGson$p (Adapty.java:32)
com.adapty.Adapty$Companion$updateProfile$1.invoke (Adapty.java:285)
com.adapty.Adapty$Companion$updateProfile$1.invoke (Adapty.java:32)
com.adapty.Adapty$Companion.addToQueue (Adapty.java:156)
com.adapty.Adapty$Companion.addToQueue$default (Adapty.java:151)
com.adapty.Adapty$Companion.updateProfile (Adapty.java:284)
app.inspiry.App.setUpAdaptyIntegrationAmplitude (App.java:164)
app.inspiry.App.access$setUpAdaptyIntegrationAmplitude (App.java:56)
app.inspiry.App$initAttribution$2.invokeSuspend (App.java:183)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (BaseContinuationImpl.java:33)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.java:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.java:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.java:750)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.java:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.java:665)

Fatal Exception: java.lang.NullPointerException

Fatal Exception: java.lang.NullPointerException
Attempt to read from field 'java.util.LinkedHashMap$LinkedEntry java.util.LinkedHashMap$LinkedEntry.nxt' on a null object reference
java.util.LinkedHashMap$LinkedHashIterator.nextEntry (LinkedHashMap.java:350)
java.util.LinkedHashMap$ValueIterator.next (LinkedHashMap.java:370)
com.adapty.internal.domain.PurchaserInteractor.syncAttributions (PurchaserInteractor.java:157)
com.adapty.internal.AdaptyInternal.executeStartRequests (AdaptyInternal.java:309)
com.adapty.internal.AdaptyInternal$executeStartRequests$1.invokeSuspend (AdaptyInternal.java)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (BaseContinuationImpl.java:33)
kotlinx.coroutines.internal.ScopeCoroutine.afterResume (ScopeCoroutine.java:43)
kotlinx.coroutines.AbstractCoroutine.resumeWith (AbstractCoroutine.java:106)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (BaseContinuationImpl.java:46)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.java:106)

Device
Brand:Xiaomi
Model:Redmi 4A

Operating System
Version:6.0.1

Why not for java?

I want to try adapty but why there is no any example for android java?

Repeated calls to https://api.adapty.io/api/v1/sdk/analytics/profiles/.../ when internet connection offline

Hi!
In offline mode on Android device Adapty is making repeated calls every few seconds:

V/Adapty_v2.9.1( 8987): VERBOSE: GET https://api.adapty.io/api/v1/sdk/analytics/profiles/.../
W/Adapty_v2.9.1( 8987): WARN: Request Error: Unable to resolve host "api.adapty.io": No address associated with hostname

Adapty SDK-Flutter version 2.9.0

The same issue for IOS is already solved
issue: adaptyteam/AdaptySDK-iOS#70
version with fix: 2.9.3

Android Lifecycle integration

It would be nice to have android lifecycle integration for methods life Adapty.getPaywalls to avoid receiving callback when a component is destroyed.

Free trial period is set though not applicable (Android)

The freeTrialPeriod attribute in the ProductModel should only be set, if it is applicable. Right now it is always set even if I purchased the subscription before. Maybe its due to using an old version of the Google billing library on Android?

SDK version 2.8.0 crashes when api.adapty.io host name is not resolved

Is there a way to catch this error instead of crashing?

Fatal Exception: com.adapty.errors.AdaptyError: Request Error: Unable to resolve host "api.adapty.io": No address associated with hostname at com.adapty.internal.data.cloud.BaseHttpClient.newCall(BaseHttpClient.kt:39) at com.adapty.internal.data.cloud.CloudRepository.getViewConfiguration(CloudRepository.kt:59) at com.adapty.internal.domain.ProductsInteractor$getViewConfiguration$1.invokeSuspend(ProductsInteractor.kt:83) at com.adapty.internal.domain.ProductsInteractor$getViewConfiguration$1.invoke(ProductsInteractor.kt:1) at com.adapty.internal.domain.ProductsInteractor$getViewConfiguration$1.invoke(ProductsInteractor.kt:2) at com.adapty.internal.domain.AuthInteractor$runWhenAuthDataSynced$3.invokeSuspend(AuthInteractor.kt:115) at com.adapty.internal.domain.AuthInteractor$runWhenAuthDataSynced$3.invoke(AuthInteractor.kt:1) at com.adapty.internal.domain.AuthInteractor$runWhenAuthDataSynced$3.invoke(AuthInteractor.kt:2) at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:217) at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt:18) at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt:18) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:34) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt:13) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt:13) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:44) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.java:112) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(BuildersKt__Builders_common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Builders.kt:1) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(BuildersKt__Builders_common.kt:47) at kotlinx.coroutines.BuildersKt.launch$default(Builders.kt:1) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(Merge.kt:33) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit(Errors.kt:158) at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$2.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(FlowKt__Collect.kt:109) at kotlinx.coroutines.flow.FlowKt.emitAll(Flow.kt:1) at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:83) at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:83) at kotlinx.coroutines.flow.FlowKt__MergeKt$flatMapConcat$$inlined$map$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(FlowKt__Limit.kt:73) at kotlinx.coroutines.flow.FlowKt__LimitKt.access$emitAbort$FlowKt__LimitKt(FlowKt__Limit.kt:1) at kotlinx.coroutines.flow.FlowKt__LimitKt$take$2$1.emit(Limit.kt:63) at com.adapty.internal.data.cloud.CloudRepository.onActivateAllowed(CloudRepository.java:177) at com.adapty.internal.data.cloud.CloudRepository$onActivateAllowed$$inlined$filter$1$2.emit(Collect.kt:135) at kotlinx.coroutines.flow.StateFlowImpl.collect(StateFlow.kt:396) at com.adapty.internal.data.cloud.CloudRepository$onActivateAllowed$$inlined$filter$1.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.FlowKt__LimitKt$take$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116) at kotlinx.coroutines.flow.FlowKt__MergeKt$flatMapConcat$$inlined$map$1.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(FlowKt__Errors.kt:156) at kotlinx.coroutines.flow.FlowKt.catchImpl(Flow.kt:1) at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invokeSuspend(Merge.kt:27) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Merge.kt:13) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Merge.kt:13) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78) at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264) at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest.flowCollect(Merge.kt:25) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157) at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(ChannelFlow.kt:6) at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.optString(java.lang.String)' on a null object reference

When calling Adapty.restorePurchases. I use the last version of adapty lib.

 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.optString(java.lang.String)' on a null object reference
        at com.android.billingclient.api.SkuDetails.getDescription(com.android.billingclient:billing@@3.0.2:1)
        at com.adapty.api.entity.restore.RestoreItem.setDetails(RestoreItem.kt:42)
        at com.adapty.purchase.InAppPurchases.fillProductInfoFromCache(InAppPurchases.kt:270)
        at com.adapty.purchase.InAppPurchases.access$fillProductInfoFromCache(InAppPurchases.kt:18)
        at com.adapty.purchase.InAppPurchases$queryPurchaseHistory$1.onPurchaseHistoryResponse(InAppPurchases.kt:225)
        at com.android.billingclient.api.zzj.run(com.android.billingclient:billing@@3.0.2:1)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

googleValidationResult is null on restorePurchase

When trying to call restorePurchase function it returns googleValidationResult as null, after making an api call we get back googleValidationResult as an object but if you navigate to RestoreReceiptResponse You'll see that it's trying to parse an ArrayList inside Attributes internal class, can you provide us with a solution please, thanks
Screen Shot 2022-08-25 at 15 01 31

Fatal Exception: java.lang.NullPointerException

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.optString(java.lang.String)' on a null object reference

com.android.billingclient.api.SkuDetails.getType (SkuDetails.java:1)
com.adapty.internal.AdaptyInternal.makePurchase (AdaptyInternal.java:168)
com.adapty.Adapty.makePurchase (Adapty.java:120)
com.adapty.Adapty.makePurchase$default (Adapty.java:111)

Device: HUAWEI nova 5T, android 10

StrictMode policy violation

Looks like in PreferenceManager you are using commit() instead of apply(). Should be simple to fix. This is important though because on some phones saving even a simple preference can take many seconds and cause ANRs.

StrictMode policy violation; ~duration=11 ms: android.os.strictmode.DiskWriteViolation
                                                                                                    	at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1622)
                                                                                                    	at libcore.io.BlockGuardOs.rename(BlockGuardOs.java:372)
                                                                                                    	at libcore.io.ForwardingOs.rename(ForwardingOs.java:698)
                                                                                                    	at android.app.ActivityThread$AndroidOs.rename(ActivityThread.java:8173)
                                                                                                    	at java.io.UnixFileSystem.rename(UnixFileSystem.java:400)
                                                                                                    	at java.io.File.renameTo(File.java:1410)
                                                                                                    	at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:786)
                                                                                                    	at android.app.SharedPreferencesImpl.-$$Nest$mwriteToFile(Unknown Source:0)
                                                                                                    	at android.app.SharedPreferencesImpl$1.run(SharedPreferencesImpl.java:680)
                                                                                                    	at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:699)
                                                                                                    	at android.app.SharedPreferencesImpl.-$$Nest$menqueueDiskWrite(Unknown Source:0)
                                                                                                    	at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:612)
                                                                                                    	at com.adapty.internal.data.cache.PreferenceManager.saveLong(PreferenceManager.kt:54)
                                                                                                    	at com.adapty.internal.data.cache.CacheRepository.saveLastAppOpenedTime(CacheRepository.kt:211)
                                                                                                    	at com.adapty.internal.utils.LifecycleAwareRequestRunner.handleAppOpenedEvent$lambda$0(LifecycleAwareRequestRunner.kt:73)
                                                                                                    	at com.adapty.internal.utils.LifecycleAwareRequestRunner.$r8$lambda$AZACOowsydQgEC-9ewPayGLIp3o(Unknown Source:0)
                                                                                                    	at com.adapty.internal.utils.LifecycleAwareRequestRunner$$ExternalSyntheticLambda0.onResult(Unknown Source:4)
                                                                                                    	at com.adapty.internal.data.cloud.AnalyticsEventRecorder$trackEvent$1$2$2.invokeSuspend(AnalyticsEventRecorder.kt:59)
                                                                                                    	at com.adapty.internal.data.cloud.AnalyticsEventRecorder$trackEvent$1$2$2.invoke(Unknown Source:8)
                                                                                                    	at com.adapty.internal.data.cloud.AnalyticsEventRecorder$trackEvent$1$2$2.invoke(Unknown Source:4)
                                                                                                    	at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223)
                                                                                                    	at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit(Errors.kt:158)
                                                                                                    	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
                                                                                                    	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
                                                                                                    	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:14)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8248)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.