Phonegap-plugin-barcodescanner: Build Failing

Created on 7 May 2016  路  10Comments  路  Source: phonegap/phonegap-plugin-barcodescanner

Has anyone had seen that the build is now failing ? I used to specify the URL in my Plugin.xml.

Plugin.xml
<plugin spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git" source="git" />

This no longer works it gives a build error :(

Most helpful comment

Found the issue, thanks a lot! @mcgrandlej was right.
I needed to install some support libs and extras:

echo y | android update sdk --no-ui --all --filter "extra-android-support" && \
echo y | android update sdk --no-ui --all --filter "extra-android-m2repository" && \
echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"

It worked after that :+1:

All 10 comments

Build does fail for Android in latest version:

:compileDebugJavaWithJavac
/data/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:24: error: cannot find symbol

import org.apache.cordova.PermissionHelper;

                     ^

symbol: class PermissionHelper

location: package org.apache.cordova

/data/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:173: error: cannot find symbol

                    intentScan.putExtra(Intents.Scan.CAMERA_ID, obj.optBoolean(PREFER_FRONTCAMERA, false) ? 1 : 0);

                                                    ^

symbol: variable CAMERA_ID

location: class Scan

/data/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:182: error: cannot find symbol

                        intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, obj.optString(ORIENTATION));

                                                        ^

symbol: variable ORIENTATION_LOCK

location: class Scan

/data/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:258: error: cannot find symbol

       if(!PermissionHelper.hasPermission(this, p))

           ^

symbol: variable PermissionHelper

location: class BarcodeScanner

/data/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:274: error: cannot find symbol

   PermissionHelper.requestPermissions(this, requestCode, permissions);

   ^

symbol: variable PermissionHelper

location: class BarcodeScanner

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

5 errors

FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':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.

BUILD FAILED

@EddyVerbruggen @vladimir-kotikov Have you noticed this build failure?

@nikhilkh The problem of the OP was also reported elsewhere and was due to not using gradle when building in phonegap build. I've added a note about it to the readme today.

The problem of @nmaas87 has not yet been investigated yet but if it's a local build simply removing the platform and plugin and re-adding those should solve it as it's a new dependency this plugin depends on that's not being fetched (for some reason).

I recreated the project with phonegap 6.2.0 on ubuntu. the installation of barcodescanner went as following:

Fetching plugin "phonegap-plugin-barcodescanner" via npm
Installing "phonegap-plugin-barcodescanner" for android
Dependent plugin "cordova-plugin-compat" already installed on android.

after that, I now get this error:

[phonegap] executing 'cordova build android --debug'...
ANDROID_HOME=/opt/android-sdk-linux

JAVA_HOME=/usr/lib/jvm/java-7-oracle

FAILURE: Build failed with an exception.

  • What went wrong:

A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_debugCompile'.

Could not find any version that matches com.android.support:support-v4:+.

 Searched in the following locations:

     https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml

     https://repo1.maven.org/maven2/com/android/support/support-v4/

     https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml

     https://jcenter.bintray.com/com/android/support/support-v4/

     file:/data/platforms/android/libs/

 Required by:

     :android:unspecified
  • Try:

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

BUILD FAILED

Total time: 10.982 secs

Error: Error code 1 for command: /data/platforms/android/gradlew with args: cdvBuildDebug,-b,/data/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

I had the same error as @nmaas87, installing "Android Support Repository" via the Android SDK Manager fixed my problem.

Found the issue, thanks a lot! @mcgrandlej was right.
I needed to install some support libs and extras:

echo y | android update sdk --no-ui --all --filter "extra-android-support" && \
echo y | android update sdk --no-ui --all --filter "extra-android-m2repository" && \
echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"

It worked after that :+1:

@nmaas87 thanks! It help me to solve my problem!

@nmaas87 Where do you enter that? On Windows. SDK Manager is reporting that Support Repository is installed.

@Gerben321 That comment was 2 years ago, I needed to install those on a clean installed Ubuntu. Today, the names and stuff have changed slightly i.e. not android update is used anymore, but sdk manager directly. So, it does not apply anymore.

This thread has been automatically locked.

Was this page helpful?
0 / 5 - 0 ratings