Gradle project sync fails with ParseError - android-studio

Gradle keeps failing to sync the project.
I get the following error message:
For best of my understating, the interpreter has an issue with parsing the module's build.gradle file.
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.b.b3"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
maxSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildToolsVersion = '28.0.2'
}
ext {
supportLibrary = "27.0.2"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha06'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha06'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:design:${supportLibrary}"
implementation 'org.osmdroid:osmdroid-android:6.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Could you check the following setting in your build.gradle file?
dependencies {
classpath 'com.android.tools.build:gradle:xxxxx'
}
I used to have the same problem as you. I don't know why. But I adjusted the above version information and the problem was solved.

Related

Failed to resolve: com.google.android.gms:play-services-clearcut:12.0.1

when I implement google places dependency and sync the Gradle file then it shows an error
Failed to resolve: com.google.android.gms:play-services-clearcut:12.0.1
App-level build. Gradle file
apply plugin : 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.hatimtekri.googlemap"
minSdkVersion 22
targetSdkVersion 28
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'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
//noinspection UseOfBundledGooglePlayServices
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.libraries.places:places:2.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
dependency
implementation 'com.google.android.libraries.places:places:2.0.0'
please please solve this error

Cannot sync project with gradle files

i cannot sync my project with gradle files.
i have this problem with all projects!
error:
Gradle sync failed: com.android.ide.common.gradle.model.level2.IdeDependenciesFactory.setRootBuildId(Ljava/lang/String;)Vcom.android.ide.common.gradle.model.level2.IdeDependenciesFactory.setRootBuildId(Ljava/lang/String;)V
i've tried change my gradle dist to newest version (gradle-4.10.3-all) and i've tried delete gradle caches.
in your classpath use:
classpath 'com.android.tools.build:gradle:3.2.1'
Now in build.gradle copy this code and make it correct as per your application.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.yourapp"
minSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2
}

build gradle failed with analytics setting error what can i do?

i clone a project from github into android studio 3.0.1 and when start build gradle show error message :
Error:(1, 0) com/android/tools/analytics/AnalyticsSettings "Open File"
and then i click open file open build.gradle
this is my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "test.myapplication"
minSdkVersion 21
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
what can i do ?
thank for answer

Failed to load AppCompat ActionBar with unknown error. Tip: Try to refresh the layout

I looked for already asked question but they was on older version of android studio and they doesn't work. As you can see I don;t have buildToolsVersion,compile and classpath
.My gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.illuminat.button"
minSdkVersion 22
targetSdkVersion 28
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:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Open app Build.gradle file.
In dependencies replace: 'com.android.support:appcompat-v7:28.0.0-alpha3'by
'com.android.support:appcompat-v7:28.0.0-alpha1'
Clic en Sync.
In res/values/style.xml change style tag to

unable to find attribute constraintSet

I had this error after I accidentally deleted something on a .debug file.
Error:In ConstraintLayout_Layout, unable to find attribute layout_constraintBaseline_creator
Error:In ConstraintSet, unable to find attribute layout_constraintBaseline_creator
Here is my build.gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "myapp.project.com.myapp"
minSdkVersion 19
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:design: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'
}
Do you have an idea how to fix this error? This error has not been removed even if I pull a new project from git. Thank you in advance.

Resources