org.gradle.internal.exceptions.LocationAwareException:, org.gradle.api.ProjectConfigurationException:, AndroidStudio3.5.3 - android-studio

After Updating Android Studio, not building Android Project, before it was building, Below is the exception,
org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'MyApplication'.
at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:99)
at org.gradle.initialization.exception.DefaultExceptionAnalyser.collectFailures(DefaultExceptionAnalyser.java:62)
at org.gradle.initialization.exception.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.exception.StackTraceSanitizingExceptionAnalyser.transform ... 75 more
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.5.3.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:201)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.access$300(DefaultCacheAwareExternalResourceAccessor.java:54)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:89)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:81)
at org.gradle.cache.internal.ProducerGuard$AdaptiveProducerGuard.guardByKey(ProducerGuard.java:97)
at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:81)
at (RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
Below is the app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.myapplication"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Below is the project gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// 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
}
I am trying to check online, Please check my gradle files and let me know where I did mistake so that I can correct myself.Thanks in Advance.

Related

Having a lot of errors while trying to create new porject in Android Studio 3.5.3

I want to create a project in Android Studio 3.5.3 by using Kotlin, but I've got a lot of errors.
the first error is:
Could not find androidx.appcompat:appcompat:1.1.0.
Required by:
project :app
After a lot of searching I added maven to repositories:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
now I get these errors:
ERROR: Failed to resolve: androidx.core:core-ktx:1.2.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: constraintlayout-solver
Affected Modules: app
ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.2.0
Show in Project Structure dialog
Affected Modules: app
I don't know what I should do to eliminate these errors. I've tried many ways but I couldn't solve these errors.
this is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

failed linking references - android studio

I'm getting the following error in my android studio project build
failed linking references,
error: resource id/edit_query (aka package:id/edit_query) not found.Message{kind=ERROR, text=error: resource id/edit_query (aka
package:id/edit_query) not found.,
sources=[C:\gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3482cd36ff1fc3489bd4ff1aeced93ab\res\values\values.xml:2689:5-2691:13],
original message=, tool name=Optional.of(AAPT)}
my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.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
}
my module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.weprcl.lathikashetty.weparcel"
minSdkVersion 16
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
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'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'org.parceler:parceler-api:1.1.11'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
annotationProcessor 'org.parceler:parceler:1.1.11'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:preference-v7: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'
}
I tried every answer in the same issue questions but without benefit so any help will be appreciated
Thanks in advance
**

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
}

Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:11.8.0

I'm getting the below error:
Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
com.google.android.gms:play-services-maps:11.8.0
This error arises while creating a new map project in android studio.
My build.gradle:
apply plugin: 'com.android.application'android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.phaniteja.maps"
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.google.android.gms:play-services-maps:11.8.0'
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'
}
Can any one help me?
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}}
Add this in build.gradle. If you are using google_service.json ensure this apply plugin: 'com.google.gms.google-services' comes after your dependencies to avoid version issues.
Add classpath too .classpath 'com.google.gms:google-services:3.2.0'

Android studio APK buil error transformClassesWithJarMergingForDebug

I'm trying to build APK, but there is an error when I try to make it.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/PendingCallback.class
Following is my build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "jordan.personicle"
minSdkVersion 19
targetSdkVersion 25
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(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/ajt-2.9.jar', 'libs/javaml-0.1.7.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services:11.0.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.android.support:multidex:1.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my build.gradle (Project)
// 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.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
I think there is no duplication for gcm. What is the problem?
Thanks,
Make sure you use the same version in all your google play services libs:
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
See https://stackoverflow.com/a/42610163/1370087

Resources