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.
Asked
Active
Viewed 61 times
0
-
The issue seems to be in your 'build.gradle' . can you please share your that file to help you to resolve the issue. – Rakshit Sorathiya Feb 07 '18 at 07:52
-
https://imgur.com/7rr8YVL – harshit dixit Feb 07 '18 at 12:20
-
Don't work offline, connect to the network/internet. And share your build.gradle file of a project. – Mayur Gangurde Feb 07 '18 at 12:32
-
You can find many of this in StackOverflow. You can try to clear gradle files from project folder. But, there's no guarantee it would work. It would be better to find the problem yourself because there can be many reasons to this problem. – Feb 07 '18 at 13:20
-
@harshitdixit try the below answer. It may help you resolve your problem. – Rakshit Sorathiya Feb 07 '18 at 16:11
1 Answers
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.

Rakshit Sorathiya
- 519
- 5
- 16