简体   繁体   中英

Gradle project sync failed. Basic functionality - failed on Android Studio 2.2

I have Android Studio version 2.2 and when I open a new project, it says in the Messages tab:

Error:C:\\Users\\Rooprai.gradle\\caches\\2.14.1\\scripts-remapped\\settings_4a7gjv1r4bbxs9f9pza41diyj\\9ejwtyixtds2dlx9q4hqm4iap\\cp_settings57408229\\cache.properties (The system cannot find the file specified).

At the top of the screen it says:

Gradle project sync failed. Basic functionality (eg editing, debugging) will not work properly.

Build Gradle:

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

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.2'

  // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } 

allprojects { repositories { jcenter() } }

task clean(type: Delete) { delete rootProject.buildDir }

buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } }

Please help, the activity_main.xml won't work.

Go to the directory \\Users\\user\\.gradle\\caches\\2.x.

You will find the directories scripts & scripts-remapped. Keep a backup of them and then delete them from the directory.

Retry gradle sync. It should work as it will generated new cache files.

Hope this helps. Thanks.

add in your build.gradle

buildTypes {
release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}

Sync gradle then clean and rebuild project.it will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM