Execution failed for task ':app:checkDebugAarMetadata'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath' - react-native

I am facing this problem, I try Multiple solutions but no luck
My build.gradle file consist
compileSdkVersion = 30
targetSdkVersion = 30
I also add following lines in build.gradle
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}
also, try these
https://exerror.com/solved-execution-failed-for-task-appcheckdebugaarmetadata/
also, install node_mudule much time
also reset cache and Gradle clean but found no luck
if anyone has any solution please update me

I was also faced with this problem,When I changed position of maven { url "https://jitpack.io"} from below to up and add maven { url "https://maven.google.com"}
Then the problem disappear.
allprojects {
repositories {
mavenLocal()
maven { url "https://jitpack.io" }
maven {
url "https://maven.google.com"
}
google()
jcenter()
}
}

uninstall the last package you added to your project npm uninstall <package-name>
and then run again.

Related

React-native Expo Build Failed : Task :app:checkDebugDuplicateClasses FAILED [duplicate]

Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.3.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and jetified-kotlin-stdlib-jdk7-1.3.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31)
**./gradlew clean **
build.gradle file:
buildscript {
ext {
buildToolsVersion = "30.0.0"
minSdkVersion = 23
compileSdkVersion = 33
targetSdkVersion = 30
googlePlayServicesAuthVersion = "16.0.1"
kotlinVersion = "1.8.0"
}
firebase: [
bom : "26.0.0"
]
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0"
classpath "com.google.gms:google-services:4.3.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
repositories {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { url 'https://maven.google.com' }
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
I had the same problem with my app. It failed to build because of duplicate classes found in modules jetified-kotlin-stdlib-1.8.0 and jetified-kotlin-stdlib-jdk8-1.6.10
With the link, shared by Igor VANIAN : https://kotlinlang.org/docs/whatsnew18.html#usage-of-the-latest-kotlin-stdlib-version-in-transitive-dependencies
I added
dependencies {
...
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
}
to my android/app/build.gradle and Android builds fine now
I started having the same issue in react native native on the android side. I upgraded Kotlin to version 1.8.0 and built the app again and the issue was fixed. Maybe trying upgrading the kotlin version.
In android/build.gradle update the following
kotlinVersion = "1.8.0"
and add this under dependencies
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
This can happen when you're using different versions for different Kotlin dependencies.
Try to check all Kotlin dependencies. In my case, issue was with this core-ktx
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Updating to this resolved issue
implementation "androidx.core:core-ktx:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Here kotlin_version = '1.7.0'. You can use your desired version.
Hope this will help others.
I was having the same problem since yesterday.
I found that the reason behind this could be the artifact merge in Kotlin 1.8.0. Here is an issue talking about this breaking change.
So setting kotlinVersion = "1.8.0" as #Narasimha said works. But I still didn't figure out what dependency changed overnight that somehow made kotlin-stdlib:1.8.0 appear in the build logs.
Thanks all, I solve it by doing two things
In android/build.gradle update the following
kotlinVersion = "1.8.0"
In android/app/build.gradle add the following in dependencies
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
I had the same issue today and I fixed it in a different way, if it helps anyone:
When I upgraded my kotlin to version 1.8 it started happening and I had to change my hilt version to 2.44. Now it's running normally.

node_modules can't find com.android.tools.build:gradle:4.1.1

Recently Android Studio was kind enough to offer to upgrade to gradle 6.5.
Naive I was: I clicked yes, then the new upgrade occured and now everytime I build I get this error similar to:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
> A problem occurred configuring project ':react-native-fs'.
> Could not resolve all artifacts for configuration ':react-native-fs:classpath'.
> Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-fs
my android/build.gradle file has those lines:
buildscript {
repositories {
mavenLocal()
google()
jcenter()
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
So life's good for my project, but not for A LOT of modules, which have this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
}
}
To solve the issue, I need to add the google() repository.
... but I don't like manually editing any file under the node_modules/ folder as any new install with break them.
Is there a way to fix this ?
Just delete node_modules folder and run
yarn install
or
npm install
reopen project in Android Studio and thats it

Google Service download failure in gradle

Followed the instructions specified in firebase cloud platform. Getting this issue while running the gradle build.
Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.gms:google-services:4.3.3.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/gms/google-services/4.3.3/google-services-4.3.3.pom
- https://jcenter.bintray.com/com/android/gms/google-services/4.3.3/google-services-4.3.3.pom
Required by:
project :
build.gradle , with the artifact added.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath("com.android.gms:google-services:4.3.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
Any inputs to the issue will help, checked firewall and proxy issues already.
There are two build.gradle files in an Android Project. One is for app-level and another one is for your project root-level.
In order to setup Firebase correctly, You have to write like following in your root-level (project-level) Gradle file (build.gradle):
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
In your module (app-level) Gradle file (usually app/build.gradle), apply the Google Services Gradle plugin like below snippet:
apply plugin: 'com.android.application'
// Add the following line:
apply plugin: 'com.google.gms.google-services' // Google Services plugin
android {
// ...
}
You are doing everything but in the app-level file. Try Fixing it and tell whether it worked or not.

how to fix "react-native-spinkit:unspecified"

What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':react-native-spinkit'.
Could not resolve all dependencies for configuration ':react-native-spinkit:classpath'.
Could not resolve com.android.tools.build:gradle:2.0.0.
Required by:
Myproject:react-native-spinkit:unspecified
Could not resolve com.android.tools.build:gradle:2.0.0.
Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0/gradle-2.0.0.pom'.
Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0/gradle-2.0.0.pom'. Received status code 403 from server: Forb
idden
android/build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "https://maven.google.com"
}
// Add jitpack repository (added by react-native-spinkit)
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
The issue seems to be related to the version not supported com.android.tools.build:gradle:2.2.3.
You can try two thing here -
1) upgrade the versions to latest and try to build again.
2) Try to change version as given below to check if its working with version 2.0.0 or not
classpath 'com.android.tools.build:gradle:2.2.3'
with
classpath 'com.android.tools.build:gradle:2.0.0'.
Hope it solves your problem !

Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2)

My React Native build quite suddenly fails with an error, in spite of working just fine a day ago with no changes that appear relevant.
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring project ':react-native-document-scanner'.
> Could not resolve all artifacts for configuration ':react-native-document-scanner:classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
Similar questions have been asked several times before, but the usual solution is to add google() to the repositories section. However
Our repositories sections already contain google()
google() already appears ahead of jcenter()
Snippet from build.gradle:
buildscript {
repositories {
// ...
google()
maven { url 'https://maven.google.com' }
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
jcenter()
}
}
// ...
allprojects {
repositories {
// ...
google()
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
jcenter()
}
}
It may or may not be relevant, though I certainly find it peculiar, that it looks to me like it successfully downloads the same thing for other dependencies:
$ ls ~/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/*
/home/petter/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/8c54aedfe9da66e64402de04883cee083c127a3b:
lint-gradle-api-26.1.2.jar
/home/petter/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/f68c47a57523ed87b225532b98f2dd2ece9552bb:
lint-gradle-api-26.1.2.pom
In my case, it's related with Fabric module,
My imported Fabric module's version was 0.5.2 (also have problem 0.5.1)
I solved this to downgrade Fabric module's version from 0.5.2 to 0.5.0
When build is success then the .jar file is created at .gradle/..
So I can use 0.5.2 version again,
I think it can be related with module's version
Run the following command inside the android folder of your react-native project:
"./gradlew build --refresh-dependencies"
This way you can find which node-module has issue in build.gradle.
I found this issue was being caused bu react-native-share module. So I updated the version to 1.1.3 in package.json for react-native-share.
The other alternative is to update the build.gradle file inside the /node-modules/react-native-share/android/ and move the google() above jcenter()
As you said the usual solution is to add google() to the repositories section. This actually also applies here.
You just need to go to your node_modules -> react-native-document-scanner -> android -> build.gradle
There, you need to modify buildscript part like the following:
buildscript {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
You probably have jcenter() above google. google() is the same thing with
maven {
url 'https://maven.google.com/'
name 'Google'
}