Detached App, Android Only - DeviceInfo module not installed Correctly

Hello!

I recently detached my application from the expo environment so I could run react-native link. I can successfully build and deploy the application to an iOS device via xCode. When I build for the Android environment in Android studio gradle reports a successful build and opens the device in a pixel simulator. The simulator will fetch my javascript bundle from XDE and attempt to launch. This is when the ‘DeviceInfo module is not installed correctly’ error appears right before the app crashes. I have installed the react-native-device-info module and ran react-native link but the same error happens. I even double checked to make sure RNDeviceInfo was in the MainApplication.java files. No dice though. Any help would be greatly appreciated.

Thanks!

Is your source code available somewhere?

Also I think we already include all the information from DeviceInfo in https://docs.expo.io/versions/v18.0.0/sdk/constants.html and https://docs.expo.io/versions/v18.0.0/sdk/util.html

Unfortunately no. It’s hosted a corporate github environment. I can post screen shots of the code if needed though. What would be helpful? I don’t have much experience with android projects so any direction would be great :smiley:

edit: Did not see the second post from you. I figured you were using that as well but installed the device info module just to be safe.

Hmm okay. Maybe you could try and detach from a fresh project and see if it works there? It’s really hard to say what’s going wrong without a way to reproduce it.

Okay, I will try it on a new project. Here are some of the logs Android Emulator right before the error is reported:

06-22 16:45:39.966 11294-11299/org.getravel.caravan I/zygote: Do full code cache collection, code=122KB, data=93KB
06-22 16:45:39.967 11294-11299/org.getravel.caravan I/zygote: After code cache collection, code=98KB, data=53KB
06-22 16:45:40.138 11294-11294/org.getravel.caravan W/unknown:Fresco: Fresco has already been initialized! Fresco.initialize(...) should only be called 1 single time to avoid memory leaks!
06-22 16:45:40.160 11294-11294/org.getravel.caravan W/unknown:React: Packager connection already open, nooping.
06-22 16:45:40.161 11294-11294/org.getravel.caravan W/unknown:React: Inspector connection already open, nooping.
06-22 16:45:40.393 11294-11327/org.getravel.caravan D/Exponent: Loaded exp.host status page.
06-22 16:45:40.457 11294-11387/org.getravel.caravan I/WebViewFactory: Loading com.android.chrome version 58.0.3029.121 (code 303012112)
06-22 16:45:40.627 11294-11387/org.getravel.caravan I/cr_LibraryLoader: Time to load native libraries: 8 ms (timestamps 5907-5915)
06-22 16:45:40.652 11294-11387/org.getravel.caravan I/chromium: [INFO:library_loader_hooks.cc(140)] Chromium logging enabled: level = 0, default verbosity = 0
06-22 16:45:40.653 11294-11387/org.getravel.caravan I/cr_LibraryLoader: Expected native library version number “58.0.3029.121”, actual native library version number “58.0.3029.121”
06-22 16:45:40.748 11294-11386/org.getravel.caravan E/ReactNativeJS: DeviceInfo native module is not installed correctly
06-22 16:45:40.767 11294-11386/org.getravel.caravan E/ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)

Update: Detaching from a fresh project does not throw the error. I detached the Expo tab project and it is working correctly.

Comparing the MainActivities and the build.gradle shows that my project is wanting to use expo sdk 16.0.0 but I upgraded to 17.0.0 when getting the project to build in xCode. I had to go in and configure xCode and change some of the plist files in order to do so. I did not see any similar instructions for the android side in the Expo docs. Is there a different process for the Android side? These are the lines in question :

MainActivity
public List sdkVersions() {
return new ArrayList<>(Arrays.asList(“16.0.0”));
}

Build.gradle:
compile(‘host.exp.exponent:expoview:16.0.0@aar’) {

Trying to change the build.gradle throws an error saying host.exp.exponent:expoview:17.0.0@aar does not exit. I can change the MainActivity file though. Do you think that would have something to do with it?

It’s much more likely to be the .aar. We have an Expo Kit upgrade guide here: https://docs.expo.io/versions/latest/guides/expokit.html#upgrading-expokit