在VScode和android studio中的Flutter中编译我的应用程序时出错

时间:2020-05-20 18:35:54

标签: android flutter gradle

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  Widget build (BuildContext context) {
    return MaterialApp(home: Text('Hello!'),);
  }
}

当我运行main.dart时,这是我在Flutter上的应用程序,出现以下错误。我已经在模拟器正常运行的情况下正确安装了Android Studio。我使用VS Code进行编辑。我运行git bash作为终端。 Flutter医生说一切都很好。

如何解决我的问题?

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > java.io.FileNotFoundException: C:\Users\shubh\OneDrive\Desktop\myCode\myApp\my_app\build\app\intermediates\signing_config\debug\out\signing-config.json (Access is denied)

* 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 8s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > java.io.FileNotFoundException: C:\Users\shubh\OneDrive\Desktop\myCode\myApp\my_app\build\app\intermediates\signing_config\debug\out\signing-config.json (Access is denied)

* 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 3s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题并已解决

找到文件“signing-config.json”,修改权限为完全控制 C:\Users\shubh\OneDrive\Desktop\myCode\myApp\my_app\build\app\intermediates\signing_config\debug\out\signing-config.json