Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安装颤振和省道后Build.Gradle文件损坏_Android_Flutter - Fatal编程技术网

Android 安装颤振和省道后Build.Gradle文件损坏

Android 安装颤振和省道后Build.Gradle文件损坏,android,flutter,Android,Flutter,我有几个安卓工作室的安卓项目,都运作得很好。昨晚我安装了Flutter和Dart插件。现在我以前的每一个项目都被破坏了。它不会建立。我打开了项目的build.gradle文件,这就是它现在的样子,一点也不像它应该是什么样子 <?xml version="1.0" encoding="UTF-8"?> <module type="JAVA_MODULE" version="4"> <c

我有几个安卓工作室的安卓项目,都运作得很好。昨晚我安装了Flutter和Dart插件。现在我以前的每一个项目都被破坏了。它不会建立。我打开了项目的build.gradle文件,这就是它现在的样子,一点也不像它应该是什么样子

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
      <excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
      <excludeFolder url="file://$MODULE_DIR$/.idea" />
      <excludeFolder url="file://$MODULE_DIR$/.pub" />


我可以简单地删除并重新创建它吗?或者有没有办法让AS重新生成此文件?我不知道它是如何以这种方式结束的。

我通过用Android Studio文档中的示例gradle文件替换xml内容,成功地实现了这一点

/**
 * The buildscript block is where you configure the repositories and
 * dependencies for Gradle itself—meaning, you should not include dependencies
 * for your modules here. For example, this block includes the Android plugin for
 * Gradle as a dependency because it provides the additional instructions Gradle
 * needs to build Android app modules.
 */

buildscript {

    /**
     * The repositories block configures the repositories Gradle uses to
     * search or download the dependencies. Gradle pre-configures support for remote
     * repositories such as JCenter, Maven Central, and Ivy. You can also use local
     * repositories or define your own remote repositories. The code below defines
     * JCenter as the repository Gradle should use to look for its dependencies.
     *
     * New projects created using Android Studio 3.0 and higher also include
     * Google's Maven repository.
     */

    repositories {
        google()
        jcenter()
    }

    /**
     * The dependencies block configures the dependencies Gradle needs to use
     * to build your project. The following line adds Android plugin for Gradle
     * version 4.0.0 as a classpath dependency.
     */

    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

/**
 * The allprojects block is where you configure the repositories and
 * dependencies used by all modules in your project, such as third-party plugins
 * or libraries. However, you should configure module-specific dependencies in
 * each module-level build.gradle file. For new projects, Android Studio
 * includes JCenter and Google's Maven repository by default, but it does not
 * configure any dependencies (unless you select a template that requires some).
 */

allprojects {
   repositories {
       google()
       jcenter()
   }
}
之后,我重建了文件,然后Android让我更新Gradle。一旦我这么做了,这个应用程序又能正常工作了