0

I'm currently working on android studio 3.0.2 on ubuntu 17. gradle syncing is creating problem. I tried the working offline and updating SDK.. but none of it worked.

enter image description here

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

You can replace your build.gradle(Module: app) with this:

 apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "com.example.goku.myapplication"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
  compile 'com.android.support:appcompat-v7:27.0.2'
  compile 'com.android.support:design:27.0.2'
  compile 'com.android.support.constraint:constraint-layout:1.0.2'
  testCompile 'junit:junit:4.12'
}

And your build.gradle(Project: MyApplication) with this:

buildscript {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
  }
}

allprojects {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
     }
   }
}
task clean(type: Delete) {
     delete rootProject.buildDir
}

Note: Make sure you are connected to internet connection. This will work for you.