KenAragorn / create_flutter_provider_app

A boilerplate project created in Flutter using Provider and Firebase.
MIT License
400 stars 117 forks source link

Gradle build failed to produce #5

Open seskiramadhan opened 4 years ago

seskiramadhan commented 4 years ago

Hi Ken,

just wanna thank you, this project is amazing

I just wanna share my problem with this project

I got this error

Exception: Gradle build failed to produce an .apk file. It's likely that this file was generated under /home/myusername/Git/create_flutter_provider_app/build, but the tool couldn't find it.

And i do solve it with creating new flutter project then copy build.grade in app folder, and paste it to your amazing template

rainerlonau commented 4 years ago

I had the same error. For me it was because I clicked the default run main.dart button to start the app. I adjusted the run configuration for "dev" and "prod" as described in "Extras 2: Config Android Studio to run Flutter Flavor" here https://medium.com/@vo9312/flutter-series-part-1-flutter-flavors-setup-bb6aba1586ac

KenAragorn commented 4 years ago

Hi @FunGuardian , thanks for the sharing. Is the exception occur everytime when you build or occasionally few times? The reason I asked this is because, I encounter before and although the exception was thrown, but the .apk file is successfully build in the project build output folder.

kirkcharlesniv commented 3 years ago

This only occurs when not running the specified commands from the documentation:

flutter run --flavor prod -t lib/main_prod.dart or flutter run --flavor dev -t lib/main.dart

kirkcharlesniv commented 3 years ago

If you are using VS Code, add these on your launch.json -> configurations

        {
            "name": "Dev",
            "request": "launch",
            "type": "dart",
            "args": [
                "--flavor",
                "dev",
                "-t",
                "lib/main.dart"
            ]
        },
        {
            "name": "Prod",
            "request": "launch",
            "type": "dart",
            "args": [
                "--flavor",
                "prod",
                "-t",
                "lib/main_prod.dart"
            ]
        }
KenAragorn commented 3 years ago

Hi @kirkcharlesniv , @rainerlonau ,

Thanks a lot for the comment and helps. This helps a lot.

I will need to update the README on this.

arturjnt commented 2 years ago

Hello @KenAragorn , if I might make a suggestion, on the README.md step 10

Instead of:

Done. Try launch the app using emulator or your preferred physical test device. For first time user, you need to create a new account from the app.

maybe a more accurate documentation would be:

Done. Try launch the app using emulator or your preferred physical test device by using flutter run --flavor dev -t lib/main.dart. For first time users, you need to create a new account from the app.

I'm only suggesting this because I too got stuck here for a few minutes until I realized what was wrong, and only now found this issue that clarifies the situation.

arturjnt commented 2 years ago

If you are using VS Code, add these on your launch.json -> configurations

        {
            "name": "Dev",
            "request": "launch",
            "type": "dart",
            "args": [
                "--flavor",
                "dev",
                "-t",
                "lib/main.dart"
            ]
        },
        {
            "name": "Prod",
            "request": "launch",
            "type": "dart",
            "args": [
                "--flavor",
                "prod",
                "-t",
                "lib/main_prod.dart"
            ]
        }

Also, this configuration worked better for me (file .vscode/launch.json)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Dev",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug",
            "program": "lib/main.dart",
            "args": [
                "--flavor",
                "dev"
            ]
        },
        {
            "name": "Prod",
            "request": "launch",
            "type": "dart",
            "flutterMode": "release",
            "program": "lib/main_prod.dart",
            "args": [
                "--flavor",
                "prod"
            ]
        }
    ]
}