atlj / react-native-background-remover

A React Native lib that removes background from images
https://www.npmjs.com/package/react-native-background-remover
MIT License
51 stars 6 forks source link

Problem when testing on Android Device #7

Open carlosmellado opened 2 months ago

carlosmellado commented 2 months ago

Everything was working fine for iOS but when switched to android, I got the following error as soon as I call at BackgroundRemover.removeBackground The error says:

There was a problem loading the project.

Could not invoke
BackgroundRemover.removeBackground

null

No content provider. http://the_image.url/url.jpg
atlj commented 2 months ago

Would it be possible for you to share the device model and the brand? Also a stack trace would be really useful. Another question is, is this a build-time or a run-time issue?

carlosmellado commented 2 months ago

It's a Xiaomi MI 8, running MIUI Global 12.0.3 with Android 10 QKQ1.190828.002 The issue is happening in runtime, at the moment I call the function.

I'll try to get the stacktrace as it wasn't appearing to me. I'll try running Android studio directly to check if I can get any info

carlosmellado commented 2 months ago

I see this on the react native console when crashing:

 ERROR  Your app just crashed. See the error below.
java.lang.NullPointerException: java.lang.NullPointerException
  expo.modules.kotlin.jni.JavaCallback.invoke(Native Method)
  expo.modules.kotlin.jni.JavaCallback.invoke(JavaCallback.kt:24)
  expo.modules.kotlin.jni.PromiseImpl.reject(PromiseImpl.kt:87)
  expo.modules.kotlin.Promise$DefaultImpls.reject(Promise.kt:15)
  expo.modules.kotlin.jni.PromiseImpl.reject(PromiseImpl.kt:26)
  expo.modules.kotlin.functions.AsyncFunction$attachToJSObject$2$functionBody$1.invoke(AsyncFunction.kt:74)
  expo.modules.kotlin.functions.AsyncFunction$attachToJSObject$2$functionBody$1.invoke(AsyncFunction.kt:66)
  expo.modules.kotlin.functions.AsyncFunction$attachToJSObject$2$3.invokeSuspend(AsyncFunction.kt:104)
  kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
  android.os.Handler.handleCallback(Handler.java:883)
  android.os.Handler.dispatchMessage(Handler.java:100)
  android.os.Looper.loop(Looper.java:224)
  android.os.HandlerThread.run(HandlerThread.java:67)
carlosmellado commented 1 month ago

@atlj did the log helped in something? Do you need more info?

atlj commented 1 month ago

Hey yeah, thanks for the logs and the device info. Sorry I'm running pretty busy for a while noe so couldn't find enough free time to come back to this. Will take another look once I find some time.

carlosmellado commented 1 month ago

Aww seems like class is not prepared to work with remote URIs, only local files, right?

zoobibackups commented 3 weeks ago

there is an issue in this library when i take picture from camera like putting the signature on paper and take picture to remove background and result of the image is black before i remove the background before after the result after @atlj

carlosmellado commented 3 weeks ago

For me it doesn't work on android. Doesn't work with remote images and for local images the background is turned black too 🥲

I tried to make the fix and I have it working with remote images but still having the black background result

raahimkhan commented 2 weeks ago

I am getting the same exact error on Android. Any fixes yet?