Android Build failed

  • 2
  • Problem
  • Updated 4 years ago
Hi.
When i build fo android, i get this error:
BarcodeScanner.java:26: error: package com.google.zxing.client.android does not exist.
And the build fails. I builds pprevius versions of my app without any problems. I dont undersand what happend.
Thanks.
This is the log

Build Date: 2016-05-10 18:36:27 +0000
Executing: ant release -f /project/build.xml
Buildfile: /project/build.xml
Buildfile: /project/build.xml

-set-mode-check:

-set-release-mode:

-check-env:
[checkenv] Android SDK Tools Revision 24.4.1

-setup:
[echo] Project Name: .NewMenu

-release-obfuscation-check:
[echo] proguard.config is ${proguard.config}

-pre-build:

-check-env:
[checkenv] Android SDK Tools Revision 24.4.1

-setup:
[echo] Project Name: .NewMenu
[gettype] Project Type: Application

-build-setup:
[gettype] Project Type: Application

-pre-clean:

clean:
[getlibpath] Library dependencies:
[getlibpath]
[getlibpath] ------------------
[getlibpath] Ordered libraries:
[getbuildtools] Using latest Build Tools: 23.0.1
[echo] Resolving Build Target for .NewMenu...

nodeps:

-check-env:
[checkenv] Android SDK Tools Revision 24.4.1

-setup:
[echo] Project Name: .NewMenu
[gettype] Project Type: Android Library

-pre-clean:

clean:

BUILD SUCCESSFUL
Total time: 1 second
[gettarget] Project Target: Android 5.1.1
[gettarget] API level: 22
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /project/bin
[mkdir] Created dir: /project/bin/res
[mkdir] Created dir: /project/bin/rsObj
[mkdir] Created dir: /project/bin/rsLibs
[mkdir] Created dir: /project/gen
[mkdir] Created dir: /project/bin/classes
[mkdir] Created dir: /project/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for .NewMenu...
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'release'...

nodeps:

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:
[echo] proguard.config is ${proguard.config}

-pre-build:

-check-env:
[checkenv] Android SDK Tools Revision 24.4.1

-setup:
[echo] Project Name: .NewMenu
[gettype] Project Type: Android Library

-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.1
[echo] Resolving Build Target for .NewMenu...
[gettarget] Project Target: Android 5.1.1
[gettarget] API level: 22
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /project/CordovaLib/res
[mkdir] Created dir: /project/CordovaLib/libs
[mkdir] Created dir: /project/CordovaLib/bin
[mkdir] Created dir: /project/CordovaLib/bin/res
[mkdir] Created dir: /project/CordovaLib/bin/rsObj
[mkdir] Created dir: /project/CordovaLib/bin/rsLibs
[mkdir] Created dir: /project/CordovaLib/gen
[mkdir] Created dir: /project/CordovaLib/bin/classes
[mkdir] Created dir: /project/CordovaLib/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for .NewMenu...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 36 source files to /project/CordovaLib/bin/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[echo] Creating library output jar file...
[jar] Building jar: /project/CordovaLib/bin/classes.jar

-post-compile:

-obfuscate:

-dex:
[echo] Library project: do not convert bytecode...

-crunch:
[crunch] Crunching PNG Files in source dir: /project/CordovaLib/res
[crunch] To destination dir: /project/CordovaLib/bin/res
[crunch] Crunched 0 PNG files to update cache

-package-resources:
[echo] Library project: do not package resources...

-package:
[echo] Library project: do not package apk...

-post-package:

-release-prompt-for-password:

-release-nosign:
[echo]
[propertyfile] Creating new property file: /project/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /project/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /project/CordovaLib/bin/build.prop
[propertyfile] Updating property file: /project/CordovaLib/bin/build.prop

-release-sign:

-post-build:

release:

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
[javac] Compiling 6 source files to /project/bin/classes
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:26: error: package com.google.zxing.client.android does not exist
[javac] import com.google.zxing.client.android.Intents;
[javac] ^
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:173: error: package Intents does not exist
[javac] intentScan.putExtra(Intents.Scan.CAMERA_ID, obj.optBoolean(PREFER_FRONTCAMERA, false) ? 1 : 0);
[javac] ^
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:174: error: package Intents does not exist
[javac] intentScan.putExtra(Intents.Scan.SHOW_FLIP_CAMERA_BUTTON, obj.optBoolean(SHOW_FLIP_CAMERA_BUTTON, false));
[javac] ^
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:176: error: package Intents does not exist
[javac] intentScan.putExtra(Intents.Scan.FORMATS, obj.optString(FORMATS));
[javac] ^
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:179: error: package Intents does not exist
[javac] intentScan.putExtra(Intents.Scan.PROMPT_MESSAGE, obj.optString(PROMPT));
[javac] ^
[javac] /project/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:182: error: package Intents does not exist
[javac] intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, obj.optString(ORIENTATION));
[javac] ^
[javac] 6 errors

BUILD FAILED
/android-sdk/tools/ant/build.xml:716: The following error occurred while executing this line:
/android-sdk/tools/ant/build.xml:730: Compile failed; see the compiler error output for details.

Total time: 5 seconds

/project/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: release,-f,/project/build.xml
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 2
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
That plugin had a major update 5 days ago. It now requires Cordova@Android 5.x.

You should build with PGB cli-6.1.0 or alternatively use an older version of the plugin.
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes
Thank you very much.
it Works fine.
I put

in te config.xml, and everything go well.

Thanks again.
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes
This is what i put:

it was erased before.
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes
sorry:

""
Photo of Valter Foresto

Valter Foresto

  • 5 Posts
  • 0 Reply Likes
Hi Jonatan, what you put in the config.xml file it's not visible.
Please can you post what you do.
We founded the same error code in the build log with ble-central plugin.
I think the issue it's not on the plugins, as sayed before, because the error it's :

/project/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: release,-f,/project/build.xml

Can you explain the workaround used, thanks.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
He most likely specified PGB cli-6.1.0 instead of the default PGB version.
Photo of Valter Foresto

Valter Foresto

  • 5 Posts
  • 0 Reply Likes
Hi Petra, I'm a newby sorry.
How can I specify to use PGB cli-6.1.0 instead of the default PGB version ?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
It's in the PGB Docs (see link in menu bar of this forum).
Preferences section: http://docs.build.phonegap.com/en_US/...
Photo of Valter Foresto

Valter Foresto

  • 5 Posts
  • 0 Reply Likes
Used in the file "config.xml" the "phonegap-version" in the "preference" tag with value="cli-6.1.0" before to submit the ZIP to PhoneGAP BUILD.

INFORMATION reference at: http://docs.build.phonegap.com/en_US/...
Thanks Petra.
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes
Valter. Hi. Thats correct. That is what i do. I tried to paste here, but it dont work
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
That's because you guys fail to read the instructions for the post editor.
See the link "some HTML allowed". It explains the CODE element.
Photo of Valter Foresto

Valter Foresto

  • 5 Posts
  • 0 Reply Likes
<preference name="phonegap-version" value="cli-6.1.0" />
Photo of Jonatan G Mauas

Jonatan G Mauas

  • 6 Posts
  • 0 Reply Likes
Thats right
Photo of Valter Foresto

Valter Foresto

  • 5 Posts
  • 0 Reply Likes
Summng up :

<preference name="phonegap-version" value="cli-6.1.0" />
it's the workaround that solve the issue in this thread.

Add the above "code" to the "config.xml" file before submit it to PhoneGAP BUILD.