Repository: flutter
Issue: Error when creating an unsigned APK, despite being built correctly
Labels: tool,t: gradle,P2,team-tool,triaged-tool

I need to create an unsigned APK.
However, when you create an unsigned APK, an error is raised, even though the APK is created successfully.

## Steps to Reproduce
1. Run `flutter create bug`.
2. Update the files as follows: 
**app.build.gradle**
```
...
    buildTypes {
        release {
            // signingConfig signingConfigs.debug // REMOVE
        }
    }
...
```

3.
```
flutter build apk
```

**Expected results:**
To be built correctly without an error message

**Actual results**
```
The APK is built correctly, but with the following error message:
Gradle build failed to produce an .apk file. It's likely that this file was generated under /Users/path/to/project/build, but the tool couldn't find it.
```

I found an APK was in fact built, but it was named `app-unsigned.apk`, instead of the usual `app.apk`.
This is probably why it was not found.

Surprisingly this is not an issue for app bundles.

<details>
  <summary>Logs</summary>

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->
```
Analyzing secrets...                                                    
No issues found! (ran in 0.8s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5 19F101, locale en-GB)
    • Flutter version 1.17.5 at /Users/yahya/Documents/dev/flutter
    • Framework revision 8af6b2f038 (4 weeks ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/yahya/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • ANDROID_HOME = /Users/yahya/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/yahya/Library/Android/sdk
    • Java binary at: /Users/yahya/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6514223/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.9.3

[!] Android Studio (version 4.0)
    • Android Studio at /Users/yahya/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6514223/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[!] IntelliJ IDEA Ultimate Edition (version 2020.1.2)
    • IntelliJ at /Users/yahya/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
```

</details>