HelloCW
HelloCW

Reputation: 2255

Why does the build.gradle (Project) disappear when I clone the project from Github in Android Studio 3.4.1?

I create a project, both build.gradle (Project) and build.gradle (Module) are listed in Android folder structure normally, look likes Old Image 1, then I sync the project to remote GitHub in Android Studio 3.4.1.

I clone the project from GitHub in another PC, I find that build.gradle (Project) disappear in Android folder structure in the another PC, look likes New Image 1, but I can find it in Project folder structure, look likes New Image 2. Why? BTW, the clone project can work well.

It seems that Github cause the problem, how can I fix it? Thanks!

Old Image 1

enter image description here

New Image 1

enter image description here

New Image 2

enter image description here

To InsurgentPointerException:

This is project level 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
}

Again to InsurgentPointerException:

You can test it by clone from

https://github.com/mycwcgr/aa

You can download the project source code of Android Studio at

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

Upvotes: 8

Views: 1237

Answers (1)

SnakeException
SnakeException

Reputation: 1186

So it seems like the Developers did that intentionally. IDK there probably used to be some setting for it but now I can't find it. This solution is a (rather lengthy) workaround.

  1. Close the target project
  2. Rename the root project folder
  3. Open the renamed project (Optional)
  4. See that there is build.gradle and app/build.gradle in the the Android View > Gradle Scripts (Optional)
  5. Close back out of the project (Optional)
  6. Do 1 -> 4 again but renaming back to the old project name.

Upvotes: 1

Related Questions