Upgrading existing ejected app to 32.0.0


#1

I’ll just cut to the chase:

I am doing what the subject line says and I am left with 1 issue on Android that relates to expo-camera.

Everything compiles and deploys to the simulator but when I click to open the code that uses the Camera control I get the following stack trace:

2019-01-31 15:07:34.248 11134-11134/my.name.spaceE/AndroidRuntime: FATAL EXCEPTION: main
    Process: my.name.space, PID: 11134
    java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Z)V in class Lcom/google/android/cameraview/CameraView; or its super classes (declaration of 'com.google.android.cameraview.CameraView' appears in /data/app/my.name.space-AUSLRKZZ9yCLWwis8PSXlw==/base.apk!classes20.dex)
        at expo.modules.camera.ExpoCameraView.<init>(ExpoCameraView.java:76)
        at expo.modules.camera.CameraViewManager.createViewInstance(CameraViewManager.java:66)
        at expo.modules.camera.CameraViewManager.createViewInstance(CameraViewManager.java:19)
        at expo.adapters.react.views.ViewGroupManagerAdapter.createViewInstance(ViewGroupManagerAdapter.java:27)
        at expo.adapters.react.views.ViewGroupManagerAdapter.createViewInstance(ViewGroupManagerAdapter.java:18)
        at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:42)

I had read that these sorts of issues arise from google-services dependency mismatches. I have done the requisite gradle work to force everything to be correct (besides that, the stack trace points to a different namespace).

I think I have found the smoking gun this morning. When I click through in Android studio on the call point for the failure, it is pointing to the following code:

 public ExpoCameraView(Context themedReactContext, ModuleRegistry moduleRegistry) {
    super(themedReactContext, true);

Which lives here: https://github.com/expo/expo/blob/master/packages/expo-camera/android/src/main/java/expo/modules/camera/ExpoCameraView.java#L76

This signature appears to be a custom constructor in a fork of the cameraview dependency that lives here:

with these signatures:

I am pulling expoview into my project with the following:

  implementation('host.exp.exponent:expoview:32.0.0@aar') {
    transitive = true
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }

and expokit is at 32.0.5.

I am unsure as to how this patched version of cameraview is supposed to get into my dependency tree, but it does seem as though the custom cameraview maintained in expo should be the one that my app is built against. It appears as though it is pulling the .aar from some remote repo. I have verfied that my reports are set up in gradle in an order consistent with what 32.0.0 is doing when ejecting.

It appears that the .aar exists in a maven repo here: https://github.com/expo/expo/tree/master/packages/expo-camera/android/maven/com/google/android/cameraview but I am not sure if these binaries are up to date (looks like they were built 4 months ago but I do not know from which source).

Could someone please provide guidance on whether there is something special I need to do to get my gradle config right or if this, in fact, was something missed when cutting the build for 32.0.0? Before updating my project; I created a detached project with 32.0.0 and tried to get the old .gradle files as close as possible to the new files in the test project so I am somewhat confident that the right things are in place.