构建失败的flutter项目/android studio

时间:2021-06-09 06:35:51

标签: kotlin dart gradle android-gradle-plugin

我安装并完成了所有必需的基本操作,但在 android studio 中运行 flutter 项目时出错

'请检查这个' ... 正在调试模式下在为 x86 构建的 Android SDK 上启动 lib\main.dart... 正在运行 Gradle 任务“assembleDebug”... 无法解析编译器类路径。检查项目“:app”中是否配置了 Kotlin Gradle 插件存储库。

FAILURE:构建失败,出现异常。

  • 出了什么问题: 无法确定任务“:app:compileDebugKotlin”的依赖关系。
<块引用>

无法解析配置“:app:kotlinCompilerClasspath”的所有依赖项。 无法从 C:\Users\HP.gradle\caches\modules-2\metadata-2.96\descriptors\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.50\edb68b65d2dd9b547bbf59d703899938

  • 试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org

    获得更多帮助

在 3m 8s 内构建失败 例外:Gradle 任务 assembleDebug 失败,退出代码为 1 ...

    import 'package:flutter/material.dart';

    void main() {
    runApp(MyApp());
    }

    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(

            primarySwatch: Colors.blue,
          ),
          home: MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }

    class MyHomePage extends StatefulWidget {
      MyHomePage({Key? key, required this.title}) : super(key: key);



      final String title;

      @override
      _MyHomePageState createState() => _MyHomePageState();
    }

    class _MyHomePageState extends State<MyHomePage> {
      int _counter = 0;

      void _incrementCounter() {
        setState(() {
              _counter++;
        });
      }

      @override
      Widget build(BuildContext context) {

        return Scaffold(
          appBar: AppBar(
            // Here we take the value from the MyHomePage object that was created by
            // the App.build method, and use it to set our appbar title.
            title: Text(widget.title),
          ),
          body: Center(
            // Center is a layout widget. It takes a single child and positions it
            // in the middle of the parent.
            child: Column(
      
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(
                  'You have pushed the button this many times:',
                ),
                Text(
                  '$_counter',
                  style: Theme.of(context).textTheme.headline4,
                ),
              ],
            ),
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: Icon(Icons.add),
          ), // This trailing comma makes auto-formatting nicer for build methods.
        );
      }
    }


    [enter image description here][1]

0 个答案:

没有答案
相关问题