当前位置: 首页 > 知识库问答 >
问题:

在Android studio中构建失败的flatter项目

茅华灿
2023-03-14

我将Android Studio升级到北极狐2020.3.1补丁3,但在我构建该项目时,Flitter项目失败了。它以前工作得很好。

以下是错误日志:

Launching lib/main.dart on SM G935S in debug mode...
Running Gradle task 'assembleDebug'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @44d075e4

* 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 16s
Exception: Gradle task assembleDebug failed with exit code 1

这是我的环境:

[✓] Flutter (Channel stable, 1.22.6, on macOS 11.6 20G165 darwin-arm, locale en-US)
    • Flutter version 1.22.6 at /Volumes/WORK/SDK/flutter
    • Framework revision 9b2d32b605 (9 months ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

 
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Volumes/WORK/SDK/Android/
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Volumes/WORK/SDK/Android/
    • ANDROID_SDK_ROOT = /Volumes/WORK/SDK/Android/
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 16.0.2+7-67)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.10.1

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] VS Code (version 1.61.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

请告诉我如何解决这个问题?

共有1个答案

毛宏达
2023-03-14

重新安装dart和FLATTER插件并重新启动ide,然后就可以了。有时无法正确配置。

 类似资料:
  • 问题内容: 我试图构建新项目,但是当我单击构建时,构建每次都会失败。 我尝试删除我的项目并再次创建它,但是仍然没有帮助。 警告 错误 这些是Xcode向我显示的错误消息。项目名称为“ MyFirstApp”,我在该错误消息上剪切了一些文件路径。那么我如何建立这个项目呢? 问题答案: 在终端中尝试:

  • 分级任务 null 在https://help.gradle.org获得更多帮助

  • 我想在ubuntu 16.04上的eclipse上构建简单的opencv程序。 我添加包含路径文件: 收件人: 并添加库路径: 收件人: 并添加: 到库(),但当我想要构建项目时,发生了此错误: 为什么?

  • 每当我试图构建包含HoloEverywhere作为依赖项的项目时,我都会遇到这样的错误: Gradle:失败:构建失败,出现异常。

  • 我正在TFS2015中运行一个构建,我得到了这个错误: 在org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217) 原因:org.apache.maven.plugin.MojoExecutionException:编译时出现致命错误 222 2018-07-25T11:22:37.0150577

  • 当我尝试使用./gradlew bundleRelise构建apk文件时,我遇到了这个错误 失败:构建失败,但有一个异常。 问题所在:任务“:app:bundleReleaseResources”的执行失败。 执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade Android 资源链接失败 C:\Users\Yoan\Re