Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
721 stars 325 forks source link

Crashing on android 11 #288

Open siddharth-kt opened 2 years ago

siddharth-kt commented 2 years ago

App is crashing on android 11 only and i got this report:

Fatal Exception: java.lang.RuntimeException: Unable to create service net.gotev.uploadservice.UploadService: java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass

Caused by java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at net.gotev.uploadservice.UploadServiceConfig.getNamespace ...

Kindly tell me the solution!!

sergeymild commented 2 years ago

I have the same error

quangphungntq commented 2 years ago

Screen Shot 2021-10-16 at 6 23 45 PM I have the same error Can anyone help us?

swizes commented 2 years ago

Edit

node_modules/react-native-background-upload/android/build.gradle b/node_modules/react-native-background-upload/android/build.gradle

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

Then apply the patch via npx patch-package react-native-background-upload

More info at https://github.com/ds300/patch-package#readme

rahul2992 commented 1 year ago

I can confirm the same error exists for me on Android 10 V2027 device.

Following is the trace: Fatal Exception: java.lang.RuntimeException: Unable to create service net.gotev.uploadservice.UploadService: java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at android.app.ActivityThread.handleCreateService(ActivityThread.java:4292) at android.app.ActivityThread.access$1800(ActivityThread.java:259) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2126) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:230) at android.app.ActivityThread.main(ActivityThread.java:7880) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

hackaprende commented 1 year ago

Error is still happening to me Version 6.6.0 RN Version 0.66.4

Tried to add packages.add(new UploaderReactPackage());

on MainApplication.java getPackages() as it says in the README but Then I get another error: [java.lang.IllegalStateException: Native module RNC_AsyncSQLiteDBStorage tried to override AsyncStorageModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true. This error may also be present if the package is present only once in getPackages() but is also automatically added later during build time by autolinking. Try removing the existing entry and rebuild.]

Hassaan68 commented 1 year ago

Error is still happening to me Version 6.6.0 RN Version 0.66.4

Tried to add packages.add(new UploaderReactPackage());

on MainApplication.java getPackages() as it says in the README but Then I get another error: [java.lang.IllegalStateException: Native module RNC_AsyncSQLiteDBStorage tried to override AsyncStorageModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true. This error may also be present if the package is present only once in getPackages() but is also automatically added later during build time by autolinking. Try removing the existing entry and rebuild.]

Hi, Have you got any solution for this ?

r0xsh commented 1 year ago

Error is still happening to me Version 6.6.0 RN Version 0.66.4

Tried to add packages.add(new UploaderReactPackage());

on MainApplication.java getPackages() as it says in the README but Then I get another error: [java.lang.IllegalStateException: Native module RNC_AsyncSQLiteDBStorage tried to override AsyncStorageModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true. This error may also be present if the package is present only once in getPackages() but is also automatically added later during build time by autolinking. Try removing the existing entry and rebuild.]

This is another issue, you have to delete packages.add(new UploaderReactPackage()); since now libraries are autolinked. We should update the README

noumantahir commented 1 month ago

still happening at large, any proposed fix so far..

Screenshot 2024-06-12 at 17 04 56
juanlaborde1895 commented 1 month ago

I'm facing the same issue right now, @noumantahir have you been able to find a solution?