Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing on android 11 #288

Open
siddharth-kt opened this issue Sep 23, 2021 · 14 comments
Open

Crashing on android 11 #288

siddharth-kt opened this issue Sep 23, 2021 · 14 comments

Comments

@siddharth-kt
Copy link

siddharth-kt commented Sep 23, 2021

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
Copy link

I have the same error

@quangphungntq
Copy link

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

@swizes
Copy link

swizes commented Nov 24, 2021

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

xHeinrich added a commit to xHeinrich/react-native-background-upload that referenced this issue Dec 3, 2021
@rahul2992
Copy link

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
Copy link

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
Copy link

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
Copy link

r0xsh commented May 11, 2023

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
Copy link

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

Screenshot 2024-06-12 at 17 04 56

@juanlaborde1895
Copy link

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

@alfarodarwaynejay
Copy link

I'm facing the same issue too, I tried

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

but it did not work

@Franco-Julian
Copy link

@juanlaborde1895 @alfarodarwaynejay have you find the way to solved this?

@alfarodarwaynejay
Copy link

@juanlaborde1895 @alfarodarwaynejay have you find the way to solved this?

No, I am planning on creating my own upload using WebView.

Something like this

@scremona-navico
Copy link

scremona-navico commented Feb 6, 2025

Add this to your build.gradle:
android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace "com.vydia.RNUploader"
} else {
// print
println "DEPRECATION WARNING: The namespace property is not available in your version of AGP. Please upgrade to AGP 4.2+."
}
...

then you'll probably need this fix too:
#343

@sobanarshad85
Copy link

try this patch file It'll fix the issue

Reason for the 1st patch is to fix compatibility issue with Android 14

see #343

see #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'
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests