Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 946
HelloCW Avatar asked Jul 01 '19 03:07

HelloCW


People also ask

Where do gradle builds go?

gradle file is located inside your project folder under app/build. gradle.

How do I sync gradle with Android project?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

Why is gradle not syncing?

It could be that you are using gradle in offline mode. To uncheck it go to File > Settings > Gradle , uncheck the Offline Work checkbox, and click Apply Make sure you have internet connection and sync the project again.

What is Gradle build Android?

Android | build.gradle. Gradle is a build system (open source) which is used to automate building, testing, deployment etc. “Build.gradle” are scripts where one can automate the tasks. For example, the simple task to copy some files from one directory to another can be performed by Gradle build script before the actual build process happens.

What does the error “Gradle project sync failed” mean in Android Studio?

What does the error, Gradle project sync failed Please fix your project and try again” in Android Studio mean? Gradle sync is one of the Gradle tasks which checks for all the dependencies present in the build. Gradle files.

Why is my Gradle project not updating APKs?

Starting in Gradle 7.0, file watching is enabled by default. If you are working on Mac OS and your project is saved under /System/Volumes/Data, Gradle file watching will not properly track file changes. This will cause the Build System to not see any file changes and it will therefore not update the APK (s).

What are the dependencies in Android Gradle?

dependencies – This specify the dependencies that are needed to build the project. Both the top-level and module-level build.gradle files are the main script files for automating the tasks in an android project and are used by the Gradle for generating the APK from the source files.


1 Answers

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.
like image 139
SnakeException Avatar answered Nov 15 '22 04:11

SnakeException