SudoPlz / sp-react-native-in-app-updates

An in-app updater for the native version of your react-native app.
MIT License
491 stars 66 forks source link

RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified on Android 14 #156

Closed tbaskijera closed 11 months ago

tbaskijera commented 1 year ago

My android build crashes on start when I run it on Android 14. It seems its due to recent changes that are targeting specifically this version.

Looking through logs, we can tell that the app is crashing because of sp-rn-in-app-updates:

FATAL EXCEPTION: create_react_context
Process: com.pinelnote, PID: 1208
java.lang.SecurityException: com.myapp: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
at com.google.android.play.core.appupdate.internal.zzl.zze(com.google.android.play:app-update@@2.0.1:4)
at com.google.android.play.core.appupdate.internal.zzl.zzb(com.google.android.play:app-update@@2.0.1:4)
at com.google.android.play.core.appupdate.zzg.registerListener(com.google.android.play:app-update@@2.0.1:1)
at com.sudoplz.rninappupdates.SpReactNativeInAppUpdatesModule.<init>(SpReactNativeInAppUpdatesModule.java:50)
at com.sudoplz.rninappupdates.SpReactNativeInAppUpdatesPackage.createNativeModules(SpReactNativeInAppUpdatesPackage.java:19)
at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1467)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1438)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1340)
at com.facebook.react.ReactInstanceManager.-$$Nest$mcreateReactContext(Unknown Source:0)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1111)
at java.lang.Thread.run(Thread.java:1012)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13908)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720)
at android.os.Binder.execTransactInternal(Binder.java:1339)
at android.os.Binder.execTransact(Binder.java:1275)

I believe the package should be updated to adapt to this. Did anyone fix it temporarily?

rahulG1996 commented 1 year ago

change DEFAULT_CORE_APP_UPDATE_VERSION to 2.1.0 in build.gradle . it will work

SudoPlz commented 1 year ago

changing the DEFAULT_CORE_APP_UPDATE_VERSION can be done without messing with the library. This is possible because of this line.

just set the playCoreAppUpdateVersion variable in your ext props config in the main build.gradle of your project.

doshijinesh commented 11 months ago

This is still not working for me. When can we except a package version upgrade that would solve this?

agusvazquez commented 11 months ago

@rahulG1996 solution worked for me! Thank you!

hamza157kashif commented 11 months ago

getting this error

A problem occurred configuring project ':sp-react-native-in-app-updates'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.