Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The plugin stops working with "Invalid number" issue #88

Closed
PandaGeek1024 opened this issue Apr 7, 2019 · 12 comments
Closed

The plugin stops working with "Invalid number" issue #88

PandaGeek1024 opened this issue Apr 7, 2019 · 12 comments

Comments

@PandaGeek1024
Copy link

As you can see it just stops working as below:

$ flutter packages pub run flutter_launcher_icons:main
Android minSdkVersion = 
FormatException: Invalid number (at character 1)

Here is my config:

flutter_icons:
  image_path: "assets/images/icon.png"
  android: true
  ios: true

And my SDK version:

minSdkVersion 21
targetSdkVersion 28
@MarkOSullivan94
Copy link
Collaborator

I don't think this is an issue with this package.

Do you know where that FormatException is being throw? Such as the file and line number

@PandaGeek1024
Copy link
Author

Somehow after I restarted the mac, it backs on working again.... I have no idea how it is fixed. Will close it anyway.

@PandaGeek1024
Copy link
Author

It happens again, now I know why. In the plugin code, it actually loads all text from gradle file and look for the minSdk assignment line for the number. Unfortunately, in my case im use a global variable so it couldn't read the number. Change it back to number solves the problem.

@shinriyo
Copy link
Contributor

@PandaGeek1024

It is closed but I also meet the problem.

because of in the android/app/build.gradle
it wrote like this.

        minSdkVersion versions.minSdk

I can resolve by replacing it the number.
where versions.minSdk came from?

@shinriyo
Copy link
Contributor

I got lit.

it was customized like this.

in android/versions.gradle

ext {
    versions = [
            compileSdk           : 29,
            minSdk               : 23,
            targetSdk            : 29,

If I have a time, I try to fix the external file supports.

@stephanie-finch
Copy link

I ran into the same error when I had defined my extension in android/build.gradle:

ext {
       compileSdkVersion   = 29
       targetSdkVersion    = 29
       minSdkVersion       = 23
   }

Passing the numbers directly in android/app/build.gradle worked for me.

Is there a separate open issue for this?

@StalderT
Copy link

In my case, I have in build.gradle file :

    defaultConfig {
        applicationId "com.xxxxxxxxxxx"
        // minSdkVersion is determined by Native View.
        minSdkVersion 20
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

Removing the line // minSdkVersion is determined by Native View. fix the issue

@talamaska
Copy link

talamaska commented Dec 9, 2021

Please reopen, We need a fix for that because the latest flutter 2.8.0 generates the gradle with variables instead of numbers

image

@marcobazzani
Copy link

marcobazzani commented Dec 18, 2021

I fixed with this PR
master...marcobazzani:patch-1

it's not great but I dunno where to find minSdk so I just handled the exception gracefully and fall back to the already present return 0

@nagringapp
Copy link

Any update on this bug?

Please reopen, We need a fix for that because the latest flutter 2.8.0 generates the gradle with variables instead of numbers

image

Any update on this bug?

I've just created a new project and added the plugin for testing and getting the following error:

flutter pub run flutter_launcher_icons:main
  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.9.1)
  ════════════════════════════════════════════


✓ Successfully generated launcher icons
Unhandled exception:
FormatException: Invalid number (at character 1)

^

#0      int._handleFormatError (dart:core-patch/integers_patch.dart:129:7)
#1      int.parse (dart:core-patch/integers_patch.dart:55:14)
#2      minSdk (package:flutter_launcher_icons/android.dart:309:18)
#3      createIconsFromConfig (package:flutter_launcher_icons/main.dart:94:47)
#4      createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)
#5      main (file:///.../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26)
#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.2)
[✓] Connected device (4 available)

@ArseneYouyem
Copy link

j'ai remplacé :
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
par:
minSdkVersion 20
targetSdkVersion 30

et ça marche à merveille

@MariamZekri
Copy link

you can define another variable with the minSdkVersion in app.gradle just make sure it is defined above defaultConfig and this a work around , you will have two minSdkVersion variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants