CRNA Android App crashing with java.lang.ClassNotFoundException:

I used CRNA to generate a mobile app, which works fine on iOS devices and the Genymotion android emulator. However it crashes on every Android device I’ve tried it on.

I believe this is the error message accompanying the crash:

E/h       (12916): java.lang.ClassNotFoundException:
E/h       (12916): Runtime exception in RNObject when calling method init: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang
.reflect.Method[] java.lang.Class.getMethods()' on a null object reference
E/j       (12916): java.lang.NoSuchFieldException: numActivities

There’s some broader context here. I’m on SDK 23.0.0, React Native 0.50.3. The Android version this is failing on include: 5.1.1, 7.0, and 7.1.1. My package.json.

I think this error is happening when I’m loading a JSON file from the filesystem which has a Base64 encoded image inside it. That image is then sent up to a server. I have not been able to figure out which line of code the error happens on, because the error does not happen when I run it in an emulator (where I can set breakpoints).

Here’s the portion of code where I believe the error is coming from:

    console.log('About to pull file from FS....');
    // Use Expo FileSystem to get JSON file with base64 image inside
    const imgString: string = await FileSystem.readAsStringAsync(
        picture.localUri   // Uri to JSON file
    console.log('File successfully pulled from fs');
    console.log('About to parse json ....');
    const imgJson = JSON.parse(imgString);
    console.log('Json successfully parsed');
    try {
        console.log('Sending response ....');
        // Uses feathers-client to talk to server
        const response: {path: remoteUri} = await pictureService.create({
            uri: imgJson.base64,  // Should be base64 encoded image
            exif: imgJson.exif,
            extension: imgJson.extension,
            inspectionId,              // String in scope but not in excerpt
            passcode                   // String in scope but not in excerpt
        console.log('Pictures sent to server! Response: ', response);
        // Register remote uri on pic
        return await dispatch(logPictureUpload(
    } catch (e) {
        const error = await e;
        console.error('Error: Sending picture up to server', error);

Any pointers on how to better debug this would be helpful. Again, this doesn’t happen in the Genymotion emulator or iOS devices.

Are you trying this on developer devices? Do you have the ‘Don’t keep activities’ setting on?


Figured it out. The file size that was going up to the server was too large. Increased the server’s max file size, and it was fixed.

I was able to catch the promise reject and pass the error to console.error. Using adb logcat, the error shows up as:

E/ReactNativeJS(12916): 'Error: Sending picture up to server', [GeneralError: request entity too large]

The reason the error was only thrown on the android devices is that the filesize for the pictures was larger. :slight_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.