Repository: flutter
Issue: Setting debuggable false in android app build.gradle buildTypes block prevent app building
Labels: tool,t: gradle,has reproducible steps,P2,found in release: 3.3,found in release: 3.4,team-tool,triaged-tool

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

**Control sample:**
1. Create a dummy project; `flutter create bug`
2. Add debuggable true to android app build.gradle. builtTypes block now look like this:
```
    buildTypes {
        debug {
            debuggable true
        }
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
```
3. Launch the app. 
4. Verify app is launching fine.

So far so good.

**The problematic bit:**

1. Set `debuggable false`. 
2. Delete flutter build folder.
3. Stop the app, run `main.dart` (no hot reloading). 

There is an error: `Exception: Gradle build failed to produce an .apk file. It's likely that this file was generated under /home/truenamer/FlutterProjects/bug/build, but the tool couldn't find it.`

Not really a big deal for me, I can live without the possibility to set `debuggable false` on debug `buildType`, and not many people are gonna use it. But still, look like a bug. 

Might be related to https://github.com/flutter/flutter/issues/54126 .

```
[✓] Flutter (Channel stable, 3.3.2, on Ubuntu 22.04.1 LTS 5.15.0-47-generic, locale en_US.UTF-8)
    • Flutter version 3.3.2 on channel stable at /home/truenamer/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (7 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/truenamer/Android/Sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /home/truenamer/Softwares/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/truenamer/Softwares/android-studio
    • Flutter plugin version 69.0.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (3 available)
    • ONEPLUS A6013 (mobile) • 0fabd948 • android-arm64  • Android 11 (API 30)
    • Linux (desktop)        • linux    • linux-x64      • Ubuntu 22.04.1 LTS 5.15.0-47-generic
    • Chrome (web)           • chrome   • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```