繁体   English   中英

Flutter build apk 命令抛出错误并且没有构建 apk

[英]Flutter build apk command is throwing errors and is not building apk

我正在尝试使用 flutter 构建 apk,但是每当我运行flutter build apk --release命令时,这就是我遇到的错误。

在此处输入图像描述

我正在使用的 java 版本是 Java 8 但使用 cmd 检查版本向我显示了这个版本

java version "1.8.0_202" Java(TM) SE Runtime Environment (build 1.8.0_202-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

最初我安装了 Java 12 但 flutter 抛出错误。

MainActivity.kt 文件的内容

package com.example.starter

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}

我认为问题出在 kotlin 编译器上。 I created a new project and Chose Java as the language for Android rather than Kotlin , copy and replaced my flutter code in this new project, and now Flutter generates the apk just fine.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM