react-native-background-upload icon indicating copy to clipboard operation
react-native-background-upload copied to clipboard

Android 14 Error: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Open sandeep14 opened this issue 1 year ago • 5 comments

getting Below error while uploading video in android

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

Please provide solution for same

sandeep14 avatar Jan 03 '24 11:01 sandeep14

Fixed this issue at my end by changing build.gradle file implementation 'net.gotev:uploadservice-okhttp:4.9.2' and kotline version kotlinVersion = '1.8.21' , plus adding plugin id 'kotlin-parcelize' . **change Version here ** buildToolsVersion = '34.0.8' compileSdkVersion = 34 targetSdkVersion = 34

sandeep14 avatar Jan 08 '24 06:01 sandeep14

@sandeep14 please take a look at https://github.com/Vydia/react-native-background-upload/pull/347#issuecomment-2203998667

mtshv avatar Jul 02 '24 18:07 mtshv

Hi guys,

I'm also facing this problem in my project. I've tried the proposed solution and while it worked in the android emulator, it didn't work on a xiaomi device with android 14.

Here is what I got from Sentry:

SecurityException One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

RemoteException: Remote stack trace:
	at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14686)
	at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:12213)
	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3188)
	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2859)
	at android.os.Binder.execTransactInternal(Binder.java:1346)

erickalvesduobox avatar Jul 16 '24 12:07 erickalvesduobox

Hi, @erickalvesduobox I followed the instructions, and the receiver error is gone for me. You can try using this patch file with patch package:

 # Reason for the 1st patch is to fix compatibility issue with Android 14
 # see https://github.com/Vydia/react-native-background-upload/issues/343
 # see https://github.com/Vydia/react-native-background-upload/pull/347

diff --git a/node_modules/react-native-background-upload/android/build.gradle b/node_modules/react-native-background-upload/android/build.gradle
index fa6963f..7a3c908 100755
--- a/node_modules/react-native-background-upload/android/build.gradle
+++ b/node_modules/react-native-background-upload/android/build.gradle
@@ -1,9 +1,9 @@
 buildscript {
     ext {
-        kotlinVersion = '1.6.0'
-        buildToolsVersion = '29.0.2'
-        compileSdkVersion = 29
-        targetSdkVersion = 29
+        kotlinVersion = '1.8.21'
+        buildToolsVersion = '34.0.8'
+        compileSdkVersion = 34
+        targetSdkVersion = 34
         minSdkVersion = 18
     }
     ext.detoxKotlinVersion = ext.kotlinVersion
@@ -20,7 +20,7 @@ buildscript {

 apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-parcelize'

 def DEFAULT_COMPILE_SDK_VERSION = 28
 def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
@@ -64,7 +64,7 @@ dependencies {

     implementation "org.jetbrains.kotlin:$_kotlinStdlib:$_kotlinVersion"

-    implementation 'net.gotev:uploadservice-okhttp:4.7.0'
+    implementation 'net.gotev:uploadservice-okhttp:4.9.2'

     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
 }

mtshv avatar Jul 22 '24 11:07 mtshv