inaturalist/react-native-inat-camera

Build issue

Opened this issue · 3 comments

I'm having trouble using this module in my own RN application. Any thoughts as to what would cause this:

> Task :app:compileDebugJavaWithJavac FAILED
D:\brilliant\monocle\HuntTheWild\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:15: error: cannot find symbol
import org.inaturalist.inatcamera.INatCameraViewPackage;
                                 ^
  symbol:   class INatCameraViewPackage
  location: package org.inaturalist.inatcamera
D:\brilliant\monocle\HuntTheWild\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:61: error: cannot find symbol
      new INatCameraViewPackage()
          ^
  symbol:   class INatCameraViewPackage
  location: class PackageList

I guess the package name should be org.inaturalist.inatcamera.nativecamera, but not why it's not being generated correctly.

Have you followed the "Integrating the Library with a React Native app" section in the README.
Acording to this, it should import from org.inaturalist.inatcamera.nativecamera.INatCameraViewPackage.

Yes, I did follow the README. That import mentioned there is in the MainApplication. React native automatically generates the PackageList.java file and seems to get it wrong. I found a work around, although I don't think this is normally necessary.

Work around in react-native.config.js:

module.exports = {
  "dependencies": {
    "react-native-inat-camera": {
      "platforms": {
        "android": {
          "packageImportPath": "import org.inaturalist.inatcamera.nativecamera.INatCameraViewPackage;",
          "packageInstance": "new INatCameraViewPackage()",
        }
      },
    }
  }
}