defold / extension-iap

In-app purchase extension for Defold
MIT License
20 stars 13 forks source link

App crashed on Android 14 device #67

Closed baochungit closed 3 months ago

baochungit commented 3 months ago

buildlog.txt

baochungit commented 3 months ago

It might be worth noting that: please set Target SDK Version to 34 to the test project

britzl commented 3 months ago

Ok, got a crash too.

07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691] Pending exception java.lang.SecurityException: com.defold.extension.iap: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at java.lang.Exception android.os.Parcel.createExceptionOrNull(int, java.lang.String) (Parcel.java:3057)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at java.lang.Exception android.os.Parcel.createException(int, java.lang.String) (Parcel.java:3041)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void android.os.Parcel.readException(int, java.lang.String) (Parcel.java:3024)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void android.os.Parcel.readException() (Parcel.java:2966)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at android.content.Intent android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(android.app.IApplicationThread, java.lang.String, java.lang.String, java.lang.String, android.content.IIntentReceiver, android.content.IntentFilter, java.lang.String, int, int) (IActivityManager.java:5684)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at android.content.Intent android.app.ContextImpl.registerReceiverInternal(android.content.BroadcastReceiver, int, android.content.IntentFilter, java.lang.String, android.os.Handler, android.content.Context, int) (ContextImpl.java:1852)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at android.content.Intent android.app.ContextImpl.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, java.lang.String, android.os.Handler) (ContextImpl.java:1792)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at android.content.Intent android.app.ContextImpl.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) (ContextImpl.java:1780)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at android.content.Intent android.content.ContextWrapper.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) (ContextWrapper.java:755)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void com.android.billingclient.api.zzg.zzc(android.content.Context, android.content.IntentFilter) (com.android.billingclient:billing@@6.0.0:1)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void com.android.billingclient.api.zzh.zze() (com.android.billingclient:billing@@6.0.0:3)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void com.android.billingclient.api.BillingClientImpl.startConnection(com.android.billingclient.api.BillingClientStateListener) (com.android.billingclient:billing@@6.0.0:48)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691]   at void com.defold.iap.IapGooglePlay.<init>(android.app.Activity, boolean) (IapGooglePlay.java:60)
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:691] 
07-04 10:15:06.531 21270 21297 F d.extension.iap: runtime.cc:699] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.SecurityException: com.defold.extension.iap: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
britzl commented 3 months ago

It seems like Google Play Billing library will not work with targetSdkVersion 34.

Android 13 (SDK version 33) introduced new flags (RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED) for broadcast receivers:

https://developer.android.com/about/versions/13/features#runtime-receivers

These flags are required for runtime registered receivers on Android 14:

https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

The receiver is registered inside the Google Play Billing client so there's not much we can do about it. There are two solutions:

1) Use targetSdkVersion 33 2) Upgrade to Billing Client 7.0.0 (https://github.com/defold/extension-iap/pull/66)

AGulev commented 3 months ago

The receiver is registered inside the Google Play Billing client so there's not much we can do about it. There are two solutions:

  1. Use targetSdkVersion 33
  2. Upgrade to Billing Client 7.0.0 (Update to Google Play Billing 7 0 0 #66)

could you please add it in release notes for 6.0.0, so people know what's going on

baochungit commented 3 months ago

As I see in https://github.com/defold/extension-iap/issues/61, there's Billing 6.0.1

Is it a fix of this issue on Android 14 with targetSdkVersion=34?

Anyway, Billing 7.0.0 is ok for me but I just wonder if there's another case :)

britzl commented 3 months ago

As I see in #61, there's Billing 6.0.1

Is it a fix of this issue on Android 14 with targetSdkVersion=34?

Aha, yes, 6.0.1 should fix Android 14 targetSdkVersion:

https://developer.android.com/google/play/billing/release-notes#6-0-1

I will test it!

AGulev commented 3 months ago

@britzl maybe we should use the latest 6.x.x (6.2.1) ?

britzl commented 3 months ago

@britzl maybe we should use the latest 6.x.x (6.2.1) ?

Sure, I'll upgrade to 6.2.1

britzl commented 3 months ago

@britzl maybe we should use the latest 6.x.x (6.2.1) ?

Sure, I'll upgrade to 6.2.1

New PR: https://github.com/defold/extension-iap/pull/68

britzl commented 3 months ago

https://github.com/defold/extension-iap/releases/tag/6.2.0