GithubHelp home page GithubHelp logo

Comments (43)

SwagatRanjit84 avatar SwagatRanjit84 commented on September 3, 2024 2

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

from react-native-document-scanner-android.

thibbo avatar thibbo commented on September 3, 2024 1

Hi there. Check this. I had the same problem and here is the solution.
#12

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024 1

Create a fresh project and after npm install ... , execute react-native link react-native-documentscanner-android

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024 1

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

from react-native-document-scanner-android.

andreluisjunqueira avatar andreluisjunqueira commented on September 3, 2024 1

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

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024

same issue, white canvas. am I missing something?

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024

Thanks for the reply @thibbo but now I get a black screen. weired!

from react-native-document-scanner-android.

marenow144 avatar marenow144 commented on September 3, 2024

Any progress on the black screen problem?

from react-native-document-scanner-android.

thibbo avatar thibbo commented on September 3, 2024

You must authorize your application to use camera permissions

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024

Yes, I have added this <uses-permission android:name="android.permission.CAMERA" /> in AndroidManifest.xml but still no luck

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

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
at process._tickCallback (internal/process/next_tick.js:160:7)

`

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 ?

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

@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

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

PermissionsAndroid.request for WRITE_EXTERNAL_STORAGE , CAMERA returns as GRANTED.

but still black screen

@SwagatRanjit84 do you have problem with build or black screen ?

from react-native-document-scanner-android.

KeiShadow avatar KeiShadow commented on September 3, 2024

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

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

from react-native-document-scanner-android.

ramusbucket avatar ramusbucket commented on September 3, 2024

@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

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

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

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

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

image

not in my case :(

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

I can share my project with you and you can test if it works?

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

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

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

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

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

saturnimus[@]gmail.com

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

@JaydeeSale saturnimus[@]gmail.com could you send ?

@SwagatRanjit84 i sent you my version

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

@saturnim sent you a drive link

from react-native-document-scanner-android.

SwagatRanjit84 avatar SwagatRanjit84 commented on September 3, 2024

@JaydeeSale naah, didn't work. Its showing black screen

from react-native-document-scanner-android.

SwagatRanjit84 avatar SwagatRanjit84 commented on September 3, 2024

@saturnim Did it work on your side?

from react-native-document-scanner-android.

saturnim avatar saturnim commented on September 3, 2024

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

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

https://drive.google.com/file/d/1mBx0zoWmZ_71ZO5W_dpGM_cG2upDURCP/view?usp=drivesdk

Here's a link to the file

from react-native-document-scanner-android.

JaydeeSale avatar JaydeeSale commented on September 3, 2024

Does the link not work?

from react-native-document-scanner-android.

audacesk avatar audacesk commented on September 3, 2024

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:

  1. react-native init --version="0.57.0" app_name
  2. cd app_name
  3. npm install --save react-native-documentscanner-android
  4. edit files:
    • in Main.Application.java: import com.documentscanner.DocumentScannerPackage;
    • in the @OverRide part: new DocumentScannerPackage()
    • in AndroidManifest.xml:
    • in AndroidManifest.xml: <application tools:replace="android:allowBackup" ...>
  5. react-native link react-native-documentscanner-android
  6. react-native run-android

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!!

from react-native-document-scanner-android.

audacesk avatar audacesk commented on September 3, 2024

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

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

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

from react-native-document-scanner-android.

audacesk avatar audacesk commented on September 3, 2024

@SwagatRanjit84 Yes please, I would really apreciate :) Thanks!!

Here is my email is wanted: gregoire.de.kermel[@]gmail.com

from react-native-document-scanner-android.

omerabbas01 avatar omerabbas01 commented on September 3, 2024

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

from react-native-document-scanner-android.

omerabbas01 avatar omerabbas01 commented on September 3, 2024

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'

from react-native-document-scanner-android.

ptibulle avatar ptibulle commented on September 3, 2024

@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'
}}
/>

from react-native-document-scanner-android.

ptibulle avatar ptibulle commented on September 3, 2024

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

from react-native-document-scanner-android.

ptibulle avatar ptibulle commented on September 3, 2024

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 ?)...

from react-native-document-scanner-android.

kalmanolah avatar kalmanolah commented on September 3, 2024

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

from react-native-document-scanner-android.

anuj002 avatar anuj002 commented on September 3, 2024

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.

from react-native-document-scanner-android.

enrique26 avatar enrique26 commented on September 3, 2024

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

from react-native-document-scanner-android.

anuj002 avatar anuj002 commented on September 3, 2024

from react-native-document-scanner-android.

thongdn avatar thongdn commented on September 3, 2024

@anuj002 you can see how to fix issue Black screen at here: #30 (comment)

from react-native-document-scanner-android.

GaetanB999 avatar GaetanB999 commented on September 3, 2024

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 ?

from react-native-document-scanner-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.