Open umutcetinkaya opened 5 years ago
Duplicated https://github.com/Michaelvilleneuve/react-native-document-scanner/issues/52
Basically, change import org.opencv.DocumentScannerPackage;
to import com.documentscanner.DocumentScannerPackage
in MainApplication.java
@jorgemarrero I'm having the same problem. I made the change as you said, but the problem was not solved?
@jorgemarrero Yes, I did it all step by step. But it didn't. :(
Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings 185 actionable tasks: 31 executed, 154 up-to-date /Users/workpc/Projects/projectname/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:27: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv /Users/workpc/Projects/projectname/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:86: error: cannot find symbol new DocumentScannerPackage(), ^ symbol: class DocumentScannerPackage 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.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 8s
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 /Users/workpc/Projects/projectname/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:27: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv /Users/workpc/Projects/projectname/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:86: error: cannot find symbol new DocumentScannerPackage(), ^ symbol: class DocumentScannerPackage 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.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 8s
at checkExecSyncError (child_process.js:591:13)
at execFileSync (child_process.js:611:13)
at runOnAllDevices (/Users/workpc/Projects/projectname/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/Users/workpc/Projects/projectname/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/Users/workpc/Projects/projectname/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
This could be related to this issue #56 ๐ค
I am actually using my own fork of this package https://github.com/Woonivers/react-native-document-scanner
You can try it:
yarn add @woonivers/react-native-document-scanner
but you will need to change all fromreact-native-document-scanner
to@woonivers/react-native-document-scanner
in your project.
This package has done a great job, but I feel it is not maintained.
@jorgemarrero your react-native version ?
@jorgemarrero your react-native version ?
0.59.9
I am using version 0.60. Would you mind if I went to the repo you called? @jorgemarrero
Ahรก, probably that's the problem. 0.60 changes a lot in Android, I haven't update for that reason :(
@jorgemarrero What can you do to make it run at 0.60.xx ? do you have an idea ?
@jorgemarrero What can you do to make it run at 0.60.xx ? do you have an idea ?
No idea, I'm sorry ๐ I will face that problem in the next few weeks/months.
The android part is very inspired by this repository https://github.com/ctodobom/OpenNoteScanner, maybe you can find some solution based on that.
Hi @umutcetinkaya , I have updated my fork to work with react-native 0.60+
hello @jorgemarrero. Trying to get it to compile, but getting
PackageList.java:17: error: cannot find symbol import org.opencv.DocumentScannerPackage;
I'm using 0.61.1. Any idea?
hello @jorgemarrero. Trying to get it to compile, but getting
PackageList.java:17: error: cannot find symbol import org.opencv.DocumentScannerPackage;
I'm using 0.61.1. Any idea?
What's version are you using?
@jorgemarrero I have cloned your master (2.0.0 I suppose) and trying to run it from example folder
@jorgemarrero I have cloned your master (2.0.0 I suppose) and trying to run it from example folder
Sorry, the example folder was pointing to the previous version. I am working on make that dynamically, but I am having issues with auto-linking.
I have updated master
with that change.
@jorgemarrero Did you know that you are running over 0.60 where you are currently forking?
hello @jorgemarrero. Trying to get it to compile, but getting
PackageList.java:17: error: cannot find symbol import org.opencv.DocumentScannerPackage;
I'm using 0.61.1. Any idea?
You should disable auto link in RN 0.60+
Edit / Create react-native.config.js
module.exports = {
dependencies: {
'react-native-document-scanner': {
platforms: {
android: null
}
}
}
};
This could be related to this issue #56 ๐ค
I am actually using my own fork of this package https://github.com/Woonivers/react-native-document-scanner
You can try it:
yarn add @woonivers/react-native-document-scanner
but you will need to change all fromreact-native-document-scanner
to@woonivers/react-native-document-scanner
in your project.This package has done a great job, but I feel it is not maintained.
Chamo, a ti te ha funcionado este repo con RN 0.60 ?
@Gricardov
Is @woonivers/react-native-document-scanner
working for both Android and iOS?
same issue for me as well. Anyone found the fix???
This repo @woonivers/react-native-document-scanner is great. Work on react-native > 0.6.0.
However, important things like detectedRectangle doesn't work on Android, only on IOS. In my case it is very important to me.
After 2 long days of work, I finally succeeded to make it work. Here is what I've done, inspired by the previous comments and this issue on react-native-splash-screen
Install
$ yarn add https://github.com/Michaelvilleneuve/react-native-document-scanner
Link manually for android First, we will disable autolink on android , so Edit / Create react-native.config.js at the root of your project
module.exports = {
dependencies: {
'react-native-document-scanner': {
platforms: {
android: null
}
}
}
};
Now link manually react-native-document-scanner and openCV in your settings.gradle file
include ':react-native-document-scanner'
project(':react-native-document-scanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-scanner/android')
include ':openCVLibrary310'
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-document-scanner/android/openCVLibrary310')
In android/app/src/main/java/com/your/project/MainActivity.java add
import com.documentscanner.DocumentScannerPackage;
In android/app/src/main/java/com/your/project/MainApplication.java add
import com.documentscanner.DocumentScannerPackage;
In android/app/build.gradle add
dependencies {
[...]
compile project(':react-native-document-scanner')
}
The process already described in the readme for iOS works correctly for me.
After 2 long days of work, I finally succeeded to make it work. Here is what I've done, inspired by the previous comments and this issue on react-native-splash-screen
Install
$ yarn add https://github.com/Michaelvilleneuve/react-native-document-scanner
Link manually for android First, we will disable autolink on android , so Edit / Create react-native.config.js at the root of your project
module.exports = { dependencies: { 'react-native-document-scanner': { platforms: { android: null } } } };
Now link manually react-native-document-scanner and openCV in your settings.gradle file
include ':react-native-document-scanner' project(':react-native-document-scanner').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-scanner/android') include ':openCVLibrary310' project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-document-scanner/android/openCVLibrary310')
In android/app/src/main/java/com/your/project/MainActivity.java add
import com.documentscanner.DocumentScannerPackage;
In android/app/src/main/java/com/your/project/MainApplication.java add
import com.documentscanner.DocumentScannerPackage;
In android/app/build.gradle add
dependencies { [...] compile project(':react-native-document-scanner') }
The process already described in the readme for iOS works correctly for me.
@obertil Followed your steps (thanks for the same!) for Android and then, it's building without issue. Though, while running the app on android device, I am getting the error "RNPdfScanner was not found in the UIManager". Repeated the steps, but still encountering this issue on Android. On iOS, facing no issues...
May be you forgot to mention some step here?
@obertil Thanks for your solution It works for me, with react-native v0.63.3 I've also upgrade the gradle version for the library as below
For ./node_modules/react-native-document-scanner/android/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 29)
buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 29)
}
}
For ./node_modules/react-native-document-scanner/android/openCVLibrary310/build.gradle
android {
compileSdkVersion 29
...
}
And for ./node_modules/react-native-document-scanner/android/gradle/wrapper/gradle-wrapper.properties
...
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
And a missing step in android/app/src/main/java/com/your/project/MainApplication.java
We should add DocumentScannerPackage
to our packages in getPackages
function:
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
packages.add(new DocumentScannerPackage());
return packages;
}
in react-native.config.js
dependencies: {
'react-native-document-scanner': {
platforms: {
"android": {
"packageImportPath": "import com.documentscanner.DocumentScannerPackage;",
"packageInstance": "new DocumentScannerPackage()"
}
}
},
"react-native-perspective-image-cropper": {
platforms: {
"android": {
"packageImportPath": "import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;",
"packageInstance": "new RNCustomCropPackage()"
}
}
}
}
Hope it will be in repo one day ๐
@skv-headless You saved my day thanks a lot.
Too late for me, I already migrated to Flutter due to this. But thanks chamo! <3
You dont need to disable link you only need to add the line below to setting.grade
include ':openCVLibrary310'
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/@woonivers/react-native-document-scanner/android/openCVLibrary310')
auto link should know that openCVLibrary310
has already been linked and will only add the code to .java
This package isn't build for android , wasting so much time over this.
, "react-native-perspective-image-cropper": { platforms: { "android": { "packageImportPath": "import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;", "packageInstance": "new RNCustomCropPackage()" } } }
Hi, thanks for the answer. Where should I be putting this? In my project or in the library?
The format you have specified caused an error while running react-native run-android
, so I did this:
module.exports = {
dependency: {
platforms: {
// iOS specific properties go here
ios: {},
// Android specific properties go here
android: {
'react-native-document-scanner': {
"packageImportPath": "import com.documentscanner.DocumentScannerPackage;",
"packageInstance": "new DocumentScannerPackage()"
},
"react-native-perspective-image-cropper": {
"packageImportPath": "import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;",
"packageInstance": "new RNCustomCropPackage()"
}
},
},
},
};
Yet I still get the same error. I would really appreciate your help.
Does anyone have an idea ?
run :
react-native run-android
result :
BUILD FAILED in 6s
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 /Users/workpc/Projects//android/app/src/main/java/com/isegeldim/MainApplication.java:10: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv /Users/workpc/Projects//android/app/src/main/java/com/isegeldim/MainApplication.java:16: error: package com.reactlibrary does not exist import com.reactlibrary.RNPdfScannerPackage; ^ /Users/workpc/Projects//android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:27: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv /Users/workpc/Projects//android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:86: error: cannot find symbol new DocumentScannerPackage(), ^ symbol: class DocumentScannerPackage location: class PackageList 4 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 6s