Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
syedsadiqali opened this issue Dec 11, 2019 · 11 comments
Open

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

syedsadiqali opened this issue Dec 11, 2019 · 11 comments

Comments

@syedsadiqali
Copy link

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.

@hashimkhatri
Copy link

@syedsadiqali did you find any solution?

@hashimkhatri
Copy link

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
Copy link

Same issue here, not sure how to fix it

@Beeltec
Copy link

Beeltec commented Apr 3, 2020

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
Copy link

JaimePata commented Apr 20, 2020

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
Copy link

shahzaibali-code commented Jun 2, 2020

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

Same issue here, not sure how to fix it

@JaimePata
Copy link

@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
Copy link
Author

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

@r0b0t3d
Copy link

r0b0t3d commented Oct 15, 2020

@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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants