Reputation: 643
So this is my first time trying to build Flutter apk file in Visual Studio code and on YouTube when they entered flutter build apk --build-name:1.0.1 --build-number=2
their code worked but for me it displayed this error:
Target file "--build-name:1.0.1" not found.
Any idea how to solve this issue. Thanks in advance
Upvotes: 0
Views: 1990
Reputation: 176
I think the issue here is that you typed --build-name: instead of --build-name= The build tool probably thinks you want to name the file instead of giving it instructions
Upvotes: 4
Reputation:
Just use flutter build apk
1.0.1 is the build name which they defined in pubspec You dont have to worry about that for more refer to https://flutter.dev/docs/testing/build-modes
Upvotes: 1
Reputation: 864
Update version:1.0.0+1
in your pubspec.yaml
.
1.0.0 represents the versionName
1 (the number after the +) represents the versionCode
After updating the version number in the pubspec.yaml
file, run flutter pub get
. This updates the versionName and versionCode in the local.properties file, which are later updated in the build.gradle file when you rebuild the Flutter app with flutter build apk
Also note that for every release, the version code has to be changed as well. Eg, you cannot simply change the version name from 1.0.0+1 to 1.1.0+1. It has to be changed to 1.1.0+2
Upvotes: 1