App crashes only on real device | React native | Expo

Viewed 1575

My app is developed using Expo, and the app works perfectly with 0 errors, 0 (code warnings), and smoothly on the Expo Go app, or any emulator, I have recently generated an APK file and wanted to test it on a real device, all android devices crash on very different screens each time, at loading, or when a specific screen is loaded

Using android studio and analyzing the APK file, the following errors pop up on load, and "java.lang.IllegalArgumentException: Unexpected type in an array: class org.json.JSONObject" exactly on crash, I feel this is the main reason why its crashing (and Logcat actually says start of crash), I have no idea what I'm doing wrong, is it something in the code, a library or what

Full stack trace

2021-05-09 18:32:12.110 10581-10581/com.example.app E/f: Failed to clear legacy OkHttp cache
    java.io.IOException: not a readable directory: /data/user/0/com.example.app/files/okhttp
        at okhttp3.internal.io.FileSystem$1.deleteContents(FileSystem.java:7)
        at okhttp3.internal.cache.DiskLruCache.delete(DiskLruCache.java:2)
        at okhttp3.Cache.delete(Cache.java:1)
        at host.exp.exponent.q.f.b(ExponentNetwork.java:4)
        at host.exp.exponent.q.f.<init>(ExponentNetwork.java:7)
        at host.exp.exponent.m.a.<init>(NativeModuleDepsProvider.java:7)
        at host.exp.exponent.m.a.c(NativeModuleDepsProvider.java:2)
        at g.a.a.b.<init>(Exponent.java:7)
        at g.a.a.b.m(Exponent.java:2)
        at host.exp.exponent.e.onCreate(ExpoApplication.java:9)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2021-05-09 18:32:12.379 10581-10636/com.example.app E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2021-05-09 18:32:12.379 10581-10636/com.example.app E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2021-05-09 18:32:12.425 10581-10636/com.example.app E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
2021-05-09 18:32:13.679 10581-10666/com.example.app E/h: java.net.MalformedURLException: no protocol: 
2021-05-09 18:32:13.748 10581-10581/com.example.app E/e: java.lang.RuntimeException: A TaskDescription's primary color should be opaque
2021-05-09 18:32:13.777 10581-10667/com.example.app E/h: java.net.MalformedURLException: no protocol: 
2021-05-09 18:32:13.785 10581-10581/com.example.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.app, PID: 10581
    java.lang.IllegalArgumentException: Unexpected type in an array: class org.json.JSONObject
        at com.facebook.internal.BundleJSONConverter$7.setOnBundle(BundleJSONConverter.java:10)
        at com.facebook.internal.BundleJSONConverter.convertToBundle(BundleJSONConverter.java:10)
        at host.exp.exponent.experience.v.A(ReactNativeActivity.java:53)
        at host.exp.exponent.experience.ExperienceActivity$e.onSuccess(ExperienceActivity.java:1)
        at g.a.a.b.w(Exponent.java:1)
        at host.exp.exponent.experience.ExperienceActivity.B(ExperienceActivity.java:1)
        at host.exp.exponent.experience.ExperienceActivity$d.execute(ExperienceActivity.java:4)
        at host.exp.exponent.t.c.c(AsyncCondition.java:2)
        at host.exp.exponent.experience.ExperienceActivity.t0(ExperienceActivity.java:4)
        at host.exp.exponent.experience.ExperienceActivity$b.f(ExperienceActivity.java:1)
        at host.exp.exponent.experience.ExperienceActivity$b.g(Unknown Source:0)
        at host.exp.exponent.experience.f.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Packages I use in my project:

  "dependencies": {
    "@expo-google-fonts/inter": "^0.1.0",
    "@react-native-async-storage/async-storage": "^1.13.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/slider": "3.0.3",
    "@react-navigation/bottom-tabs": "^5.11.9",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.4",
    "@reduxjs/toolkit": "^1.5.1",
    "axios": "^0.21.1",
    "expo": "^41.0.0",
    "expo-font": "~9.1.0",
    "expo-localization": "~10.1.0",
    "expo-splash-screen": "~0.10.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.5.4",
    "i18n-js": "^3.8.0",
    "moment": "^2.29.1",
    "native-base": "^2.15.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "0.63.4",
    "react-native-calendars": "^1.1258.0",
    "react-native-check-box": "^2.1.7",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-i18n": "^2.0.15",
    "react-native-maps": "0.27.1",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-reanimated": "~2.1.0",
    "react-native-safe-area-context": "3.2.0",
    "react-native-screens": "~3.0.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "12.1.0",
    "react-native-svg-transformer": "^0.14.3",
    "react-native-unimodules": "~0.13.3",
    "react-native-web": "~0.13.12",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-redux": "^7.2.3",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@expo/webpack-config": "~0.12.63",
    "@svgr/webpack": "^5.5.0",
    "babel-jest": "~25.2.6",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.13.1"
  },

Edit: I highly think that the problem is within react-native-maps library, I either configured it incorrectly, or the package has some errors.

Edit: Above problem was solved by removing MapView from 'react-native-maps'. Here's the code

              <MapView
                initialRegion={{
                  latitude: Number(lat),
                  longitude: Number(lng),
                  latitudeDelta: 0.005,
                  longitudeDelta: 0.005,
                }}
              >
                <Marker
                  coordinate={{
                    latitude: Number(lat),
                    longitude: Number(lng),
                  }}
                  title={name}
                />
              </MapView>
1 Answers
Related