flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.71k stars 27.62k forks source link

Execution failed for task ':app:compileFlutterBuildRelease' #123892

Closed nkpouto99 closed 1 year ago

nkpouto99 commented 1 year ago

Am having problem building my project, when I build it in debug mode it goes fine but when I build it in profile mode and release mode it gives me error. And If I do flutter run for debug mode it successfully build and throws me a new error.

Dart snapshot generator failed with exit code -1073741819 Target android_aot_release_android-arm failed: Exception: AOT snapshotter exited with code -1073741819

FAILURE: Build failed with an exception.

BUILD FAILED in 4m 32s Running Gradle task 'assembleRelease'... 275.1s Gradle task assembleRelease failed with exit code 1 Thats the error I get when I run flutter build apk --release

And I get this error when I run flutter build apk --profile

FAILURE: Build failed with an exception.

BUILD FAILED in 18m 30s Running Gradle task 'assembleProfile'... 1114.7s Gradle task assembleProfile failed with exit code 1 Then I get success when building for debug mode, but if am running the debug mode this what I get

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Running Gradle task 'assembleDebug'... 1721.3s √ Built build\app\outputs\flutter-apk\app-debug.apk. Failed to extract manifest from APK: ProcessException: The command failed Command: C:\Users\Lenovo\AppData\Local\Android\sdk\build-tools\33.0.2\aapt dump xmltree C:\Users\Lenovo\Desktop\ALL\Flutter-Apps\portfolio\build\app\outputs\flutter-apk\app-debug.apk AndroidManifest.xml. Exception: Problem building Android application: see above error(s). So I decided to upgrade flutter to the latest which is 3.7.8 since almost every solution I see on the internet is not working and even other answer on same issue is not working, have checked the flutter community and no solution.

I decided to create a new project and run it, behold got a the same error!!!

Running Gradle task 'assembleDebug'... 715.1s √ Built build\app\outputs\flutter-apk\app-debug.apk. Failed to extract manifest from APK: ProcessException: The command failed Command: C:\Users\Lenovo\AppData\Local\Android\sdk\build-tools\33.0.2\aapt dump xmltree C:\Users\Lenovo\Desktop\ALL\Flutter-Apps\food\build\app\outputs\flutter-apk\app-debug.apk AndroidManifest.xml. Exception: Problem building Android application: see above error(s). Please what should I do? I need help

This my Flutter doctor -v

C:\Users\Lenovo>flutter doctor -v [√] Flutter (Channel stable, 3.7.8, on Microsoft Windows [Version 10.0.22000.318], locale en-US) • Flutter version 3.7.8 on channel stable at C:\Users\Lenovo\Desktop\ALL\Flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 90c64ed42b (10 days ago), 2023-03-21 11:27:08 -0500 • Engine revision 9aa7816315 • Dart version 2.19.5 • DevTools version 2.20.1

This is taking an unexpectedly long time...[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at C:\Users\Lenovo\AppData\Local\Android\sdk • Platform android-TiramisuPrivacySandbox, build-tools 33.0.2 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619) • All Android licenses accepted.

[√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] VS Code (version 1.73.1) • VS Code at C:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.60.0

[!] Connected device ! No devices available

[√] HTTP Host Availability • All required HTTP hosts are available

! Doctor found issues in 1 category.

Even if I connect my device it still the same This my version tool

Flutter 3.7.8 • channel stable • https://github.com/flutter/flutter.git Framework • revision 90c64ed42b (10 days ago) • 2023-03-21 11:27:08 -0500 Engine • revision 9aa7816315 Tools • Dart 2.19.5 • DevTools 2.20.1 Gradle is: 8.0.2 Gradle plugin is: 7.2.0 Kotlin is: 1.7.10

nkpouto99 commented 1 year ago

flutter_01.log

nkpouto99 commented 1 year ago

Please need urgent help

bartekpacia commented 1 year ago

It's hard to help you since you didn't attach any code that others can run locally to reproduce the issue.

nkpouto99 commented 1 year ago

It's hard to help you since you didn't attach any code that others can run locally to reproduce the issue.

This my dependencies dependencies: flutter: sdk: flutter

cupertino_icons: ^1.0.2 url_launcher: ^6.1.10 flutter_inappwebview: ^5.7.2+3 webview_flutter: ^4.0.6 connectivity_plus: ^3.0.3 permission_handler: ^10.2.0

dev_dependencies: flutter_test: sdk: flutter flutter_launcher_icons: ^0.12.0 flutter_lints: ^2.0.0 build_runner: ^2.3.3 flutter_native_splash: ^2.2.19

My main.dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/src/material/theme_data.dart';
import 'package:path/path.dart' as p;
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';

final Uri _url = Uri.parse('https://mkpouto.xyz');
final Uri _urlport = Uri.parse('https://twitter.com/FGikpayee');

void main() async {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  if (Platform.isAndroid) {
    await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
  }
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);

  Future.delayed(const Duration(seconds: 2)).then((onValue) async => {
    await Permission.storage.request(),
    await Permission.camera.request(),
    await Permission.location.request(),
    await Permission.microphone.request(),
    if (await Permission.camera.status.isDenied) {
      await Permission.camera.request(),
    } else if (await Permission.location.status.isDenied) {
      await Permission.location.request(),
    } else if (await Permission.microphone.status.isDenied) {
      await Permission.microphone.request(),
    } else if (await Permission.storage.status.isDenied) {
      await Permission.storage.request(),
    } else if (await Permission.location.isRestricted) {
      FlutterNativeSplash.remove(),
      runApp(const MyApp()),
    } else {
      FlutterNativeSplash.remove(),
      runApp(const MyApp()),
    },
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Mkpouto\'s Tech',
      theme: ThemeData(primarySwatch: Colors.blue, visualDensity: VisualDensity.standard),
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Mkpouto\'s Tech'),
        centerTitle: true,
        elevation: 0,
      ),
      bottomNavigationBar: Padding(
        padding: EdgeInsets.fromLTRB(3, 6, 3, 6),
        child: RichText(
          text: TextSpan(
            text: 'Connect with me Online - ',
            style: TextStyle(color: Colors.black),
            recognizer: TapGestureRecognizer()..onTap = () => _launchURL(),
            children: [
              TextSpan(
                text: '@FGikpayee',
                style:
                    TextStyle(color: Colors.blue, fontWeight: FontWeight.w600),
                recognizer: TapGestureRecognizer()..onTap = () => _launchURL(),
              )
            ],
          ),
          textAlign: TextAlign.center,
        ),
      ),
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            children: [
              SizedBox(height: 12),
              MaterialButton(
                onPressed: _launchUrl,
                child: const Text(
                  'Portfolio',
                  style: TextStyle(color: Colors.white),
                ),
                color: Colors.green,
                padding: EdgeInsets.symmetric(horizontal: 70, vertical: 12),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Future<void> _launchUrl() async {
  if (!await launchUrl(_url)) {
    throw Exception('Could not launch $_url');
  }
}

Future<void> _launchURL() async {
  if (!await launchUrl(_urlport)) {
    throw Exception('Could not launch $_urlport');
  }
}
nkpouto99 commented 1 year ago

I later found out that most dependencies for app build was not installed because of network issues and I resolve this as downgrading and upgrading flutter again which it installed all the dependencies

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.