jail-monkey icon indicating copy to clipboard operation
jail-monkey copied to clipboard

Error: Exception in HostObject::get(propName:JailMonkey): java.lang.NullPointerException

Open sahil290791 opened this issue 3 years ago • 7 comments

jail-monkey version: 2.3.2 RN: 0.61.5

Setup: android/app/build.gradle:

dependencies {
   ....
   ....
   ....
    implementation project(':jail-monkey')
    implementation project(':react-native-branch')
   ....

settings.build.gradle

include ':jail-monkey'
project(':jail-monkey').projectDir = new File(rootProject.projectDir, '../node_modules/jail-monkey/android')

I am getting this error in some of the android devices (Samsung note 20 Ultra):

com.facebook.react.common.JavascriptException: Error: Exception in HostObject::get(propName:JailMonkey): java.lang.NullPointerException, stack:
<unknown>@1788:122
v@2:1474
<unknown>@1785:349
v@2:1474
<unknown>@386:200
v@2:1474
<unknown>@6:58
v@2:1474
d@2:876
global code@3823:4

at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Method.java)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:371)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:150)
  at com.facebook.react.bridge.queue.NativeRunnable.run (NativeRunnable.java)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:26)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:225)
  at java.lang.Thread.run (Thread.java:923)

Can you please help on what might be wrong here?

sahil290791 avatar Nov 29 '20 01:11 sahil290791

I have the same issue "jail-monkey": "^2.3.3", "react-native": "0.61.5",

Samsung Galaxy Note9, Android 10 Samsung Galaxy S9+, Android 10

bohdansushchak avatar Jan 04 '21 10:01 bohdansushchak

I have the same issue "jail-monkey": "^2.3.2", "react-native": "0.61.5",

Galaxy Note10+, Android 10 Galaxy Note9, Android 10 Galaxy S20+, Android 11

hwq0521 avatar Jan 05 '21 01:01 hwq0521

Getting this issue as well. It seems to be exclusive to Samsung devices.

It comes in as Exception in HostObject::get(propName:JailMonkey): java.lang.NullPointerException: Attempt to get length of null array sometimes as well

nzankich avatar Feb 09 '21 01:02 nzankich

my team only uses the mocked location and rooted check so it must be from one of those. If I had to guess it's coming from the mocked location check here:

                    pm.getInstalledApplications(PackageManager.GET_META_DATA);

Android docs say that it can't come back as null https://developer.android.com/reference/android/content/pm/PackageManager#getInstalledApplications(int)

BUT I do see some cases online where people say it's coming back as null if permission settings are wrong. it's just a guess though. Almost everything else in there is covered by try/catches

nzankich avatar Feb 09 '21 17:02 nzankich

@nzankich If at the android side it is coming as null, does it mean it is not a rooted device?

mountainfirefly avatar Mar 16 '21 16:03 mountainfirefly

@mountainfirefly if anything it would be the opposite. maybe the rooted device is disrupting/blocking that check?

I don't think there is any correlation though. I think Samsung devices have a bug/are just doing something against Android specs

nzankich avatar Mar 16 '21 19:03 nzankich

Had this problem today too and came here via google. Samsung device. Any idea what could cause it? Could be our JM version is too old, this seems to have been fixed in 2.6.0 https://github.com/GantMan/jail-monkey/commit/2492b473b26c434c84a3f1c492668fa34fbd5479

pke avatar May 12 '22 09:05 pke