Open JaydeeSale opened 5 years ago
same issue, white canvas. am I missing something?
Hi there. Check this. I had the same problem and here is the solution. https://github.com/andreluisjunqueira/react-native-documentscanner-android/issues/12
Thanks for the reply @thibbo but now I get a black screen. weired!
Any progress on the black screen problem?
You must authorize your application to use camera permissions
Yes, I have added this <uses-permission android:name="android.permission.CAMERA" />
in AndroidManifest.xml but still no luck
Hi, I have problem with build. I went thru this steps:
react-native init ProjectName cd ProjectName npm install --save react-native-documentscanner-android (edit files like in readme) react-native start react-native run-android
build log: `JS server already running. Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Configure project :app WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Configure project :openCVLibrary310 WARNING: The specified Android SDK Build Tools version (23.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '23.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Configure project :react-native-documentscanner-android WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:compileDebugJavaWithJavac FAILED C:\Users\rychlewr\react\InvoicesApp\android\app\src\main\java\com\invoicesapp\MainApplication.java:10: error: package com.documentscanner does not exist import com.documentscanner.DocumentScannerPackage; ^ C:\Users\rychlewr\react\InvoicesApp\android\app\src\main\java\com\invoicesapp\MainApplication.java:26: error: cannot find symbol new MainReactPackage(),new DocumentScannerPackage() ^ symbol: class DocumentScannerPackage 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 5s 15 actionable tasks: 1 executed, 14 up-to-date Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:574:11)
at Object.execFileSync (child_process.js:592:13)
at runOnAllDevices (C:\Users\rychlewr\react\InvoicesApp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\rychlewr\react\InvoicesApp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\rychlewr\react\InvoicesApp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at
`
As we can see in log DocumentScannerPackage is not imported correctly.
I saw you are one step further. Do you have some tips? Did you do any other steps to run this project ? Is Ndk required to run it ?
Create a fresh project and after npm install ...
, execute react-native link react-native-documentscanner-android
@thibbo this time I went to settings > installed apps > app_name > permissions
on my phone and manually gave camera permissions and it worked. But app has to ask for these permissions. Let me figure that out This may not be related to this library. But thanks a lot!
@ramusbucket Thank you for your tip.
Now i have this black screen issue.
I extended manifest :
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
And manualy gave camera permissions in settings > installed apps > app_name > permissions. My view:
<View style={{ flex: 1, backgroundColor: '#fff' }}>
<DocumentScanner style={{ flex: 1, backgroundColor: '#fff' }}
onPictureTaken={data =>{
console.log(data.path)
}}
enableTorch={false}
detectionCountBeforeCapture={5}
/>
</View>
I get a black screen
PermissionsAndroid.request for WRITE_EXTERNAL_STORAGE , CAMERA returns as GRANTED.
but still black screen
@SwagatRanjit84 do you have problem with build or black screen ?
Did you try set the dimension of camera layout in css ? Height and width.
po 28. 1. 2019 v 9:03 odesílatel saturnim notifications@github.com napsal:
PermissionsAndroid.request for WRITE_EXTERNAL_STORAGE , CAMERA returns as GRANTED.
but still black screen
@SwagatRanjit84 https://github.com/SwagatRanjit84 do you have problem with build or black screen ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andreluisjunqueira/react-native-documentscanner-android/issues/15#issuecomment-458030949, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ_pyUzP79TeVeC_SKNXYGhSSF0Y5bTOks5vHq7EgaJpZM4Z8mRc .
-- Petr Noga
| Phone: +420 734 216 637
| Email: n.skypo@gmail.com
| Address: Ostrava-City, Czech Republic | Follow me on https://www.linkedin.com/in/petr-noga-5a6aa6124/ https://github.com/KeiShadow
@KeiShadow
Yes i tried few different layouts. Component is drown but black.
@SwagatRanjit84
my build configs: ReactNativeProject/node_modules/react-native-documentscanner-android/android/build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
}
dependencies {
compile project(':openCVLibrary310')
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.58.1"
compile 'com.google.zxing:core:3.0.1'
compile 'com.android.support:design:28.0.0'
compile 'org.piwik.sdk:piwik-sdk:0.0.4'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'us.feras.mdv:markdownview:1.1.0'
}
ReactNativeProject\android\build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}
ReactNativeProject\android\settings.gradle
rootProject.name = 'ReactNativeProject'
include ':app'
include ':react-native-documentscanner-android'
project(':react-native-documentscanner-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-documentscanner-android/android')
include ':openCVLibrary310'
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-documentscanner-android/android/openCVLibrary310')
go to android and perform : gradle clean b4 build
Maybe somebody can point bugs in my config ?
@SwagatRanjit84 try in a fresh project. Don't forget to link
the library as my last comment. You will get these kind of errors when you either did not link
or link
did not configure the project properly
Hi there. Check this. I had the same problem and here is the solution.
12
i can confirm that this did solve the white screen issues, the black screen issue is related to permissions
Hi there. Check this. I had the same problem and here is the solution.
12
i can confirm that this did solve the white screen issues, the black screen issue is related to permissions
not in my case :(
I can share my project with you and you can test if it works?
@JaydeeSale would be excellent, but did you change something in react-native-documentscanner-android ? if yes pls share changed files too. (build files ect.)
and one more question, does it work on emulator ? if yes can you point emulated device ?
I haven't tried it on a emulated device. But no I haven't changed any of the document scanner files... So you should be able to npm install and run it... Pm me you email or something and I'll send it through
saturnimus[@]gmail.com
@JaydeeSale saturnimus[@]gmail.com could you send ?
@SwagatRanjit84 i sent you my version
@saturnim sent you a drive link
@JaydeeSale naah, didn't work. Its showing black screen
@saturnim Did it work on your side?
@SwagatRanjit84 did not work even in version from @JaydeeSale . Only one issue might be i used not orginal build script for document scaner component. Or some enviroment issue...
https://drive.google.com/file/d/1mBx0zoWmZ_71ZO5W_dpGM_cG2upDURCP/view?usp=drivesdk
Here's a link to the file
Does the link not work?
Hey guys have you tried to add "flex: 1" to component style
<DocumentScanner
style={{ flex: 1 }} <------ Try it
onPictureTaken={data =>{
console.log(data.path)
}}
enableTorch={false}
detectionCountBeforeCapture={5}
/>
Hello everyone,
First of all, I'm sorry to bother you with an issue like this one. I've been stuck for quite a long time and not finding the path to an error-free process. I'm still at the installation process.
Here what I'm doing so far for trying make it works:
And look at what happens: C:\Users\Utilisateur\Documents\ReactNative\docscan>react-native run-android Starting JS server... Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Configure project :app WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Configure project :openCVLibrary310 WARNING: The specified Android SDK Build Tools version (23.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove "buildToolsVersion '23.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Configure project :react-native-documentscanner-android WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :openCVLibrary310:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Task :react-native-documentscanner-android:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Task :app:compileDebugJavaWithJavac FAILED C:\Users\Utilisateur\Documents\ReactNative\docscan\android\app\src\main\java\com\docscan\MainApplication.java:7: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv 1 error
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 15s 58 actionable tasks: 36 executed, 22 up-to-date Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html
I'm using Windows 10 and in Visual Studio, I've a "problem log" appearing: "Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-4.4-all.zip'. Could not create parent directory for lock file C:\ProgramData\chocolatey\lib\gradle\tools\gradle-5.2.1\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4-all.zip.lck"
Do you guys know I'm doing wrong? Thanks a lot!!
@SwagatRanjit84 My problem is that I cannot build the project on my windows. I've followed the Readme's step, the building configs of @saturnim , and some other stuff that I found online, but I'm still having this error:
"FAILURE: Build failed with an exception.
Compilation failed; see the compiler error output for details.
"Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-4.4-all.zip'. Could not create parent directory for lock file C:\ProgramData\chocolatey\lib\gradle\tools\gradle-5.2.1\wrapper\dists\gradle-4.4-all\9br9xq1tocpiv8o6njlyu5op1\gradle-4.4-all.zip.lck"
@SwagatRanjit84 Yes please, I would really apreciate :) Thanks!!
Here is my email is wanted: gregoire.de.kermel[@]gmail.com
Hey, Tried every thing in above comments but still having white screen issue. Permission is set, Used style={{ flex: 1 }}. Not sure what to do also there is one more issue i have noticed in log cat 2019-03-04 13:44:04.170 6810-6810/com.documentscanner E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV
Hey, Tried every thing in above comments but still having white screen issue. Permission is set, Used style={{ flex: 1 }}. Not sure what to do also there is one more issue i have noticed in log cat 2019-03-04 13:44:04.170 6810-6810/com.documentscanner E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV
Worked by changing style to backgroundColor: 'transparent'
@SwagatRanjit84 Please, can you share your Git with me ? I only resolve a problem to find another one... #help (ptibulle[@]gmail.com) @omerabbas01 I have the same error : Cannot load info library for OpenCV... Where did you write backgroundColor: 'transparent' ? <DocumentScanner ... style={{ flex: 1, backgroundColor: 'transparent' }} />
@SwagatRanjit84 share to me his git project and it resolves the OpenCV library loading problem. (thanks) The error "Cannot load info library for OpenCV" is still here but the library is loaded just after so it should not be a real problem.
But the detection of rectangular paper doesn't work ! The camera is on and I can see it on the screen but the document is not detected. I try it on 3 devices (Nokia, Samsung and Zebra (Android device for logistic)) and I get the same problem.
While trying to detect, there is a loop of logs like these : 03-12 09:52:24.076 17254-17254/com.billscanner D/JavaCameraView: sending message to ImageProcessor: previewFrame - com.documentscanner.helpers.PreviewFrame@18410f0 03-12 09:52:24.076 17254-17330/com.billscanner D/ImageProcessor: Message Received: previewFrame - com.documentscanner.helpers.PreviewFrame@18410f0 03-12 09:52:24.114 17254-17330/com.billscanner I/DESENHAR: Quad----->null
The "Quad----->null" seems to say "no rectangle detected" ??? But I have a document : sheet of white paper on dark background.
Any idea ???
Ok by approaching the camera very close to the document (80% of the screen), the detection worked. I was using it like with other scan library I try (not OSS) OpenCV seems less permissive (or we can parameter this ?)...
@SwagatRanjit84 Think you could share the secrets to getting this library to work with me as well? I'm currently stuck on the black screen issue, and I've tried all of the "fixes" mentioned in all of the issues in this repo. :sweat_smile:
It worked on react native version 0.57.8, after adding
implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:appcompat-v7:27.0.2' implementation 'com.android.support:design:27.1.0'
in android/app/build.gradle
It worked on react native version 0.57.8, after adding
implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:appcompat-v7:27.0.2' implementation 'com.android.support:design:27.1.0'
in android/app/build.gradle
@SwagatRanjit84 Thanks for this. Also it worked on react native version 0.59.8.
Also it worked on react native version 0.59.8.
@anuj002 can you share please your configurations for android/app/build.gradle and android/build.gradle, for RN 59.8? i´m still can´t run the app after added those lines thanks
Hi,
It's working for a seconds only, but right now its Showing only black screen with error "OpenCV error: Cannot load info library for OpenCV". If you find any solution please let me know.
-- Thanks & Regard Anuj Agrawal React Native & Android Developer
Handheld: agrawalanuj002@gmail.com abhishekjangid.appzoro@gmail.com +919462797441
On Fri, Jun 7, 2019 at 3:03 AM enrique26 notifications@github.com wrote:
Also it worked on react native version 0.59.8.
@anuj002 https://github.com/anuj002 can you share please your configurations for android/app/build.gradle and android/build.gradle, for RN 59.8? i´m still can´t run the app after added those lines thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andreluisjunqueira/react-native-documentscanner-android/issues/15?email_source=notifications&email_token=AHAROHKG7MFHOF6SSZVOXCTPZF7BDA5CNFSM4GPSMROKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXEHGAQ#issuecomment-499675906, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAROHIGVBBI3ETAPZXIRHDPZF7BDANCNFSM4GPSMROA .
@anuj002 you can see how to fix issue Black screen at here: https://github.com/andreluisjunqueira/react-native-documentscanner-android/pull/30#issue-295843425
Hello,
is it working with RN 0.60.5 ?
I'm stuck with this error on Build :
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.bat app:installDebug -PreactNativeDevServerPort=8081 C:...\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:21: error: cannot find symbol import org.opencv.DocumentScannerPackage; ^ symbol: class DocumentScannerPackage location: package org.opencv C:...\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:61: error: cannot find symbol new DocumentScannerPackage(), ^ symbol: class DocumentScannerPackage location: class PackageList 2 errors
FAILURE: Build failed with an exception.
Any idea ?
I cant seem to get it to work,
ive followed the guide, also had to add the implementation lines in the build gradle before it would build.
finally got it bult and installed, but the canvas shows nothing but white ?
any ideas on how to get the camera preview to actual display something ? i initially thought i was to do with opencv not init , but when looking at the logcat logs i can see the SUCCESS fro opencv debug line, then nothing after .
any help would be appreciated