Fórum erro ao criar apk #623758

11/06/2025

0

Boa noite! pessoal to começando agora com o flutter mais já to com uma dor de cabeça grande, to tentando criar minha apk mais sempre ta interropendo com erro antes compilação do apk.

erro mostrado no android estudio:

lib/app/app.dart:279:11: Error: A value of type ''''bool Function(X509Certificate/*1*/, String, int)'''' can''''t be assigned to a variable of type ''''bool Function(X509Certificate/*2*/, String, int)?''''.
- ''''X509Certificate/*1*/'''' is from ''''package:webview_flutter_platform_interface/src/types/x509_certificate.dart'''' (''''/C:/Users/devjo/AppData/Local/Pub/Cache/hosted/pub.dev/webview_flutter_platform_interface-2.13.1/lib/src/types/x509_certificate.dart'''').
- ''''X509Certificate/*2*/'''' is from ''''dart:io''''.
(X509Certificate cert, String host, int port) => true;
^
Target kernel_snapshot_program failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task '''':app:compileFlutterBuildRelease''''.
> Process ''''command ''''C:\src\flutter\bin\flutter.bat'''''''' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2m 55s
Running Gradle task ''''assembleRelease''''... 177,2s
Gradle task assembleRelease failed with exit code 1

---------------------------------------------------------------------------------------------------------------------------------------------------------

esse arquivo logo abaixo -> ''''package:webview_flutter_platform_interface/src/types/x509_certificate.dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import ''''package:flutter/foundation.dart'''';

/// Represents an X.509 certificate.
@immutable
class X509Certificate {
/// Creates an [X509Certificate].
const X509Certificate({this.data});

/// A DER representation of the certificate object.
final Uint8List? data;
}

------------------------------------------------------------------------------------------------------------------------------------------

classe que fica no arquivo -> app.dart

class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}

--------------------------------------------------------------------------------------------------------------------------------------

ja tentei de tudo e não consigo roda e nem criar o apk
Josewandson

Josewandson

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar