react-native-perspective-image-cropper icon indicating copy to clipboard operation
react-native-perspective-image-cropper copied to clipboard

cannot find symbol import org.opencv.RNCustomCropPackage;

Open syedsadiqali opened this issue 5 years ago • 11 comments

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 /home/syed/projects/HeroMobileApp/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:30: error: cannot find symbol import org.opencv.RNCustomCropPackage; ^ symbol: class RNCustomCropPackage location: package org.opencv /home/syed/projects/HeroMobileApp/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:88: error: cannot find symbol new RNCustomCropPackage(), ^ symbol: class RNCustomCropPackage location: class PackageList 2 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

syedsadiqali avatar Dec 11 '19 13:12 syedsadiqali

@syedsadiqali did you find any solution?

hashimkhatri avatar Dec 26 '19 17:12 hashimkhatri

I find a jack its not a proper solution: some changes in this file (node_modules@react-native-community\cli-platform-android\native_modules.gradle)

in this variable ----> def generatedFileContentsTemplate (line no 8) you gonna see this {{ packageImports }} (line no 21) after this add import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;

and

in this function ----> void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate) { (line no 121) replace this line ----> "// ${it.name}\n${it.packageImportPath}" with if(it.name != "react-native-perspective-image-cropper"){ "// ${it.name}\n${it.packageImportPath}" }else{ "// ${it.name}\n //${it.packageImportPath}" }

hashimkhatri avatar Dec 26 '19 22:12 hashimkhatri

Same issue here, not sure how to fix it

TakaKeiji avatar Feb 28 '20 15:02 TakaKeiji

Hi,

the package is not yet optimized for React Native's autolinking feature. A workaround is creating a file named "react-native.config.js" in the modules root folder with the following content:

module.exports = {
  dependency: {  
    platforms: {  
      android: {  
        packageImportPath: 'import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;',  
        packageInstance: 'new RNCustomCropPackage()',  
      },  
    },  
  },  
};  

Beeltec avatar Apr 03 '20 12:04 Beeltec

Hi,

the package is not yet optimized for React Native's autolinking feature. A workaround is creating a file named "react-native.config.js" in the modules root folder with the following content:

module.exports = {
  dependency: {  
    platforms: {  
      android: {  
        packageImportPath: 'import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;',  
        packageInstance: 'new RNCustomCropPackage()',  
      },  
    },  
  },  
};  

Did that and the bad import was still being generated in Package.list. Do I need to do something else in order to make it work?. Seems like my react-native-config is being ignored.

EDIT: Made it work, I had a typo and wrote react-native-config.js instead of react-native.config.js

JaimePata avatar Apr 20 '20 17:04 JaimePata

@syedsadiqali Did you solve this error ? @JaimePata this solution not working ...

Same issue here, not sure how to fix it

shahzaibali-code avatar Jun 02 '20 15:06 shahzaibali-code

@shahzaibali-code the solution worked for me, but is far from ideal. The react-native-config file that you should edit is the one from react-native-perspective-image-cropper, inside your node modules. So everytime you install the module you should change that file.

JaimePata avatar Jun 02 '20 15:06 JaimePata

@shahzaibali-code sorry I'm not working on react native for a long time.

syedsadiqali avatar Jun 02 '20 17:06 syedsadiqali

@JaimePata there is 2 ways you can overcome that issue.

  1. Try to make a fork of this repo then add react-native.config.js and use it instead. If you can make a PR, it will be great.
  2. Use patch-package.

Currently, I used the option 2 because I have to modify the source code to fit my need.

r0b0t3d avatar Oct 15 '20 02:10 r0b0t3d

Hi,

the package is not yet optimized for React Native's autolinking feature. A workaround is creating a file named "react-native.config.js" in the modules root folder with the following content:

module.exports = {
  dependency: {  
    platforms: {  
      android: {  
        packageImportPath: 'import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;',  
        packageInstance: 'new RNCustomCropPackage()',  
      },  
    },  
  },  
};  

Still facing the issue.

Hosam-hsm avatar Nov 02 '20 18:11 Hosam-hsm

@Beeltec Hi, Your solution is worked for me. Thank you. Note: I am not using this package. I integrated opencv to develop with c++ in my React Native project. But it was giving this error. This answer fixed the problem. Thanks again 🙌

yasintorun avatar Dec 29 '22 06:12 yasintorun