Michaelvilleneuve / react-native-perspective-image-cropper

Perform custom crop, resizing and perspective correction ๐Ÿ“๐Ÿ–ผ
MIT License
306 stars 127 forks source link

cannot find symbol import org.opencv.RNCustomCropPackage; #33

Open syedsadiqali opened 4 years ago

syedsadiqali commented 4 years ago

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.

hashimkhatri commented 4 years ago

@syedsadiqali did you find any solution?

hashimkhatri commented 4 years ago

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}" }

TakaKeiji commented 4 years ago

Same issue here, not sure how to fix it

Beeltec commented 4 years ago

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()',  
      },  
    },  
  },  
};  
JaimePata commented 4 years ago

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

shahzaibali-code commented 4 years ago

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

Same issue here, not sure how to fix it

JaimePata commented 4 years ago

@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.

syedsadiqali commented 4 years ago

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

r0b0t3d commented 4 years ago

@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.

Hosam-hsm commented 3 years ago

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.

yasintorun commented 1 year ago

@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 ๐Ÿ™Œ