0

I just installed a fresh new Android Studio on a fresh new Windows 7. I created a new empty project and Android Studio keeps failing at project syncing. I tried few solutions people posted on SO, but none of them worked so I decided to show you my project structure hoping someone can help.

So, this is my project's gradle file:

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

buildscript {

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


    // 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
}

And module's gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.kompjutor.myapplication"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}

And those are the errors I'm getting:

Errors

Any ideas, please?

user8789149
  • 121
  • 4
  • 12
  • Try adding `maven {url "https://maven.google.com"}` in project level build.gradle under buldscript.repositories and `maven { url "https://jitpack.io" }` in project level build.gradle under allprojects.repositories – Saran Sankaran Dec 10 '17 at 12:11
  • still the same errors.. :/ – user8789149 Dec 10 '17 at 13:11
  • do u use any proxies ? it is just sync issue. Go to settings > search proxy or gradle sync and make it run . – Rizvan Dec 12 '17 at 10:49
  • "No proxy" option is selected.. and when I search "Gradle", option "Use default gradle wrapper (recommended)" is selected – user8789149 Dec 12 '17 at 20:03

2 Answers2

2

Issue could be caused by the following reasons

  1. Gradle has not synced the libraries.
  2. Android Studios offline mode is activated.

See this for more info

Raza
  • 831
  • 9
  • 10
1

Go to File->Project Structure.

In the Dependency Tab Choose Plus icon appears green then choose Library dependency. And add through that. If still problem appears update Support Repository through SDK Manager

enter image description here