Hello all, my team and I finalized some changes to our flutter application’s codebase, but upon cloning it this morning, I am encountering this issue when building the application.
A problem occurred evaluating project ‘:app’.
For input string: “0.1.0”
I am told the error occurs at this line of code:
‘versionCode flutterVersionCode.toInteger()’
within the defaultConfig{…}, where flutterVersionCode == “0.1.0”
After running with --stacktrace, I am seeing this top-most error: Caused by: java.lang.NumberFormatException: For input string: “0.1.0”,
build_7mkxoqyoylmpjb7l9cf62z06c$_run_closure2$_closure7.doCall().
Any help is very much appreciated if anyone has encountered this or has any idea what is going on. I’m willing to give any specifics that might clarify the issue as well. My team and I are now at a bit of a standstill trying to identify when the error began to occur, as some of us were not privy to the changes.
Tyler
You cannot convert the string "0.1.0"
to an integer, that’s what the error is telling you. Perhaps flutterVersionCode
used to be a string containing an integer value? What does the commit history say?
I’m not an Android developer, but here’s some documentation on versionCode
and versionName
, which I think applies to your situation.
Hey there,
Thanks for your response. After going through several versions of the code, it seems like the file raising the error had always been like that, so I’m not exactly sure why it’s acting raising that error now. Regardless, it was a simple fix, and we just changed the value of flutterVersionCode to an integer, but for some reason, that string could not be converted to an integer now even though it had always looked like that in spite of that string not being an integer. Strange, but your suggestion was accurate, and this documentation clarifies how we should approach this value in the future. Thank you for your help, Chris.