Dynamsoft / capture-vision-cordova-samples

Dynamsoft Capture Vision Cordova SDK Samples
Other
5 stars 8 forks source link

Android build error #2

Closed jskrepnek closed 3 years ago

jskrepnek commented 5 years ago

Hi,

I'm getting an error building with this plugin:

app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find :dbr:.

Node version: v8.15.0 Cordova version: 8.0.0 Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-28,android-27,android-26 Gradle: installed /usr/local/Cellar/gradle/5.1/bin/gradle

yanshen6 commented 5 years ago

Hi, I'm getting an error building with this plugin: app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.

    Could not find :dbr:.

Node version: v8.15.0 Cordova version: 8.0.0 Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-28,android-27,android-26 Gradle: installed /usr/local/Cellar/gradle/5.1/bin/gradle

You can try like this: cordova create MyCordovaProject io.cordova.hellocordova CordovaApp cd MyCordovaProject cordova platform add android@6.2.0 cordova plugin add local-path/cordova-plugin-dbr cordova build android

jskrepnek commented 5 years ago

@yanshen6 We're using Cordova Android 7.1.1. 6.2.0 is almost 2 years old. Have you tried building this with version 7?

jskrepnek commented 5 years ago

On line https://github.com/dynamsoft-dbr/cordova-plugin-dbr/blob/23740c4d112098acb5ceaf9dfc17ba384d9b9eeb/src/android/barcodescanner.gradle#L12:

Updating from libs to src/main/libs allows compilation to proceed.

I also had to update https://github.com/dynamsoft-dbr/cordova-plugin-dbr/blob/23740c4d112098acb5ceaf9dfc17ba384d9b9eeb/src/android/barcodescanner.gradle#L23 to `compile 'com.android.support:support-v4:27.1.0'

yanshen6 commented 5 years ago

On line

  cordova-plugin-dbr/src/android/barcodescanner.gradle

     Line 12
  in
  23740c4

       dirs 'libs' 

: Updating from libs to src/main/libs allows compilation to proceed. I also had to update

  cordova-plugin-dbr/src/android/barcodescanner.gradle

     Line 23
  in
  23740c4

       compile 'com.android.support:support-v4:+' 

to `compile 'com.android.support:support-v4:27.1.0'

YES, it is great! I'll put this solution in readme. Thanks!

amit-khanduri-valuecoders commented 4 years ago

Is there any integration of this plugin with android 8.1.0, facing the same issue this side, it throws an error like : FAILURE: Build failed with an exception.

Edit: When I further looked at the issue it's not picking up the path to dbr.aar, instead it's taking the maybe this is the issue, maybe not, but the path it searched for in the project's directory doesn't goes to app/src/main/libs/dbr.aar, Instead it goes app/libs/dbr.aar. Just a bunch of my thoughts after staring at the error for a while.

zyunique commented 4 years ago

Is there any integration of this plugin with android 8.1.0, facing the same issue this side, it throws an error like : FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugApkCopy'. Could not find com.android.support:support-v4:27.1.0. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar Required by: project : Could not find :dbr:. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.aar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager//dbr//dbr-.aar Required by: project :

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edit: When I further looked at the issue it's not picking up the path to dbr.aar, instead it's taking the maybe this is the issue, maybe not, but the path it searched for in the project's directory doesn't goes to app/src/main/libs/dbr.aar, Instead it goes app/libs/dbr.aar. Just a bunch of my thoughts after staring at the error for a while.

Have you tried this ? image

amit-khanduri-valuecoders commented 4 years ago

Is there any integration of this plugin with android 8.1.0, facing the same issue this side, it throws an error like : FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugApkCopy'. Could not find com.android.support:support-v4:27.1.0. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar Required by: project : Could not find :dbr:. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.aar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager//dbr//dbr-.aar Required by: project :

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edit: When I further looked at the issue it's not picking up the path to dbr.aar, instead it's taking the maybe this is the issue, maybe not, but the path it searched for in the project's directory doesn't goes to app/src/main/libs/dbr.aar, Instead it goes app/libs/dbr.aar. Just a bunch of my thoughts after staring at the error for a while.

Have you tried this ? image

I have and it still throws an error Edit: I tried it again today now it's throwing 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

Task :app:preBuild UP-TO-DATE Task :CordovaLib:preBuild UP-TO-DATE Task :CordovaLib:preDebugBuild UP-TO-DATE Task :CordovaLib:checkDebugManifest UP-TO-DATE Task :CordovaLib:processDebugManifest UP-TO-DATE Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

zyunique commented 4 years ago

Is there any integration of this plugin with android 8.1.0, facing the same issue this side, it throws an error like : FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugApkCopy'. Could not find com.android.support:support-v4:27.1.0. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar Required by: project : Could not find :dbr:. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.aar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager//dbr//dbr-.aar Required by: project :

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edit: When I further looked at the issue it's not picking up the path to dbr.aar, instead it's taking the maybe this is the issue, maybe not, but the path it searched for in the project's directory doesn't goes to app/src/main/libs/dbr.aar, Instead it goes app/libs/dbr.aar. Just a bunch of my thoughts after staring at the error for a while.

Have you tried this ? image

I have and it still throws an error Edit: I tried it again today now it's throwing 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

Task :app:preBuild UP-TO-DATE Task :CordovaLib:preBuild UP-TO-DATE Task :CordovaLib:preDebugBuild UP-TO-DATE Task :CordovaLib:checkDebugManifest UP-TO-DATE Task :CordovaLib:processDebugManifest UP-TO-DATE Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find :dbr:. Required by: project :app

My test_Project's Cordova version is 9.0.0 and cordova-android version is 8.1.0, I just add the cordova-plugin-dbr, then modify index.html and index.js in test_Project/www/. I also have the same warning but it does not matters.

amit-khanduri-valuecoders commented 4 years ago

Is there any integration of this plugin with android 8.1.0, facing the same issue this side, it throws an error like : FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugApkCopy'. Could not find com.android.support:support-v4:27.1.0. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager/com/android/support/support-v4/27.1.0/support-v4-27.1.0.jar Required by: project : Could not find :dbr:. Searched in the following locations: file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.pom file:/Users/abhishek/Library/Android/sdk/extras/android/m2repository//dbr//dbr-.aar file:/Users/abhishek/Desktop/Test_Projects/barcode_test_7/platforms/android/sdk-manager//dbr//dbr-.aar Required by: project :

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edit: When I further looked at the issue it's not picking up the path to dbr.aar, instead it's taking the maybe this is the issue, maybe not, but the path it searched for in the project's directory doesn't goes to app/src/main/libs/dbr.aar, Instead it goes app/libs/dbr.aar. Just a bunch of my thoughts after staring at the error for a while.

Have you tried this ? image

I have and it still throws an error Edit: I tried it again today now it's throwing 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

Task :app:preBuild UP-TO-DATE Task :CordovaLib:preBuild UP-TO-DATE Task :CordovaLib:preDebugBuild UP-TO-DATE Task :CordovaLib:checkDebugManifest UP-TO-DATE Task :CordovaLib:processDebugManifest UP-TO-DATE Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find :dbr:. Required by: project :app

My test_Project's Cordova version is 9.0.0 and cordova-android version is 8.1.0, I just add the cordova-plugin-dbr, then modify index.html and index.js in test_Project/www/. I also have the same warning but it does not matters.

I am not saying about the warning, I am telling you about the build failed part, specifically

Could not find :dbr:.
Required by:
project :app

EDIT: Got it working, my ANDROID_SDK_ROOT wasn't set, I had to set it open a new terminal remove the old build and make another build to get it running