当我在Android Studio 3.4.1中从Github克隆项目时,为什么build.gradle(项目)消失了?

Hel*_*oCW 8 github gradle android-studio

我创建一个项目,build.gradle(Project)和build.gradle(Module)都在Android文件夹结构中正常列出,看起来像Old Image 1,然后将项目同步到Android Studio 3.4.1中的远程GitHub。

我从另一台PC上的GitHub克隆了项目,发现build.gradle(Project)在另一台PC上的Android文件夹结构中消失了,看起来像New Image 1,但是我可以在Project文件夹结构中找到,看起来像New Image 2。为什么?顺便说一句,克隆项目可以很好地工作。

似乎Github引起了问题,我该如何解决?谢谢!

旧图1

在此处输入图片说明

新形象1

在此处输入图片说明

新形象2

在此处输入图片说明

要InsurgentPointerException:

这是项目级别的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    ext.kotlin_version = '1.3.40'
    ext.anko_version = '0.10.8'

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

再次到InsurgentPointerException:

您可以通过克隆从测试

https://github.com/mycwcgr/aa

您可以在以下位置下载Android Studio的项目源代码

https://www.dropbox.com/s/ko8stedl135ohnt/MyTest.zip?dl=0

Sna*_*ion 1

所以看起来开发商是故意这样做的。IDK 可能曾经有一些设置,但现在我找不到它。该解决方案是一个(相当冗长)的解决方法。

  1. 关闭目标项目
  2. 重命名根项目文件夹
  3. 打开重命名的项目(可选)
  4. 在 Android View > Gradle Scripts (Optional) 中看到build.gradleapp/build.gradle
  5. 关闭项目(可选)
  6. 再次执行 1 -> 4,但重命名回旧项目名称。