Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Generated .gradle file invalid, parseInt takes wrong argument #512

Closed
zaubara opened this issue Jul 24, 2017 · 6 comments
Closed

Generated .gradle file invalid, parseInt takes wrong argument #512

zaubara opened this issue Jul 24, 2017 · 6 comments
Labels

Comments

@zaubara
Copy link

zaubara commented Jul 24, 2017

Expected Behaviour

Gradle build should work.

Actual Behaviour

Crash in:
platforms/android/phonegap-plugin-barcodescanner/appname-barcodescanner.gradle' line: 3
Works when concatenating what looks like to be an array now;
if (cdvMinSdkVersion == null || Integer.parseInt('' + cdvMinSdkVersion) < minSdk ) {
seems to work.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Remove android platform and re-add it completely.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 7.1.2

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

OnePlus

Cordova CLI version and cordova platform version

7.0.1

Installed platforms:
android 6.2.3
ios 4.4.0
Available platforms:
blackberry10 ~3.8.0 (deprecated)
browser ~4.1.0
osx ~4.0.1
webos ~3.7.0

Plugin version

phonegap-plugin-barcodescanner 6.0.8 "BarcodeScanner"

Sample Code that illustrates the problem

Logs taken while reproducing problem

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/<>/Documents/_git/<>/platforms/android/phonegap-plugin-barcodescanner/<>-barcodescanner.gradle' line: 3

  • What went wrong:
    A problem occurred evaluating script.

No signature of method: static java.lang.Integer.parseInt() is applicable for argument types: (java.lang.Integer) values: [16]
Possible solutions: parseInt(java.lang.String), parseInt(java.lang.String, int), print(java.lang.Object), print(java.io.PrintWriter)

@majid701
Copy link

Same issue! Anyone who fixed it?

@cyberbobjr
Copy link

same issue too :(

@runelk
Copy link

runelk commented Jul 31, 2017

The empty string concatenation trick makes the app compile, but it might just be a quickfix to a problem further up the chain somewhere. For my Ionic app the file to be edited is in platforms/android/phonegap-plugin-barcodescanner/starter-barcodescanner.gradle

@jemc771
Copy link

jemc771 commented Aug 3, 2017

Hi, I fixed that error modifying the code in 'phonegap-plugin-barcodescanner-master\src\android\barcodescanner.gradle'

if (cdvMinSdkVersion == null || Integer.parseInt(cdvMinSdkVersion) < minSdk ) {
ext.cdvMinSdkVersion = minSdk;
}

for this:

if (cdvMinSdkVersion == null) {
ext.cdvMinSdkVersion = minSdk;
}
else{
int num = cdvMinSdkVersion as Integer
if(num < minSdk ){
ext.cdvMinSdkVersion = minSdk;
}
}

@macdonst
Copy link
Member

@zaubara thanks, I just pushed a fix.

Mischa1610 added a commit to sovanta/phonegap-plugin-barcodescanner-custom-ui that referenced this issue Aug 16, 2017
* phonepag/master:
  🐧 Issue phonegap#508: Is there any way to disable the beep in android?
  🐧 Issue phonegap#512: Generated .gradle file invalid, parseInt takes wrong argument
  Convert the handler functions for the torch, flipCamera, and shutter buttons to IBAction (phonegap#511)
  Update README.md
  Update README.md

# Conflicts:
#	src/android/barcodescanner.gradle
#	src/ios/CDVBarcodeScanner.mm
Mischa1610 added a commit to sovanta/phonegap-plugin-barcodescanner-custom-ui that referenced this issue Aug 16, 2017
* develop:
  EWEEM-1651: Set plugin version to 6.1.9.
  EWEEM-1651: Using version 2.1.9-sov of the barcodescanner-lib-aar-custom-ui now.
  EWEEM-1651: Changed flashlight and close buttons to resources of the plugin.
  EWEEM-1063: Made the barcode scanner quadrat bigger.
  Added flashlight active and inactive icons for iOS.
  Added close icons for iOS.
  Removed unused torch icons for iOS.
  🐧 Issue phonegap#508: Is there any way to disable the beep in android?
  🐧 Issue phonegap#512: Generated .gradle file invalid, parseInt takes wrong argument
  Convert the handler functions for the torch, flipCamera, and shutter buttons to IBAction (phonegap#511)
  Update README.md
  Update README.md
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

6 participants