react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
254 stars 2 forks source link

RN 0.73.7 to 0.73.8 - Failed to transform react-android-0.73.8-debug.aar #270

Closed FelipeSSantos1 closed 5 months ago

FelipeSSantos1 commented 5 months ago

Environment

Things I’ve done to figure out my issue

Upgrading version

RN 0.73.7 to 0.73.8

Description

Local build failing for Android

> Task :app:checkLocalDebugAarMetadata FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
81 actionable tasks: 81 executed

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkLocalDebugAarMetadata'.
> Could not resolve all files for configuration ':app:localDebugRuntimeClasspath'.
   > Failed to transform react-android-0.73.8-debug.aar (com.facebook.react:react-android:0.73.8) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not find react-android-0.73.8-debug.aar (com.facebook.react:react-android:0.73.8).
        Searched in the following locations:
            https://jcenter.bintray.com/com/facebook/react/react-android/0.73.8/react-android-0.73.8-debug.aar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 4m 8s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installLocalDebug -PreactNativeDevServerPort=8081 -PreactNativeDebugArchitectures=arm64-v8a -PreactNativeArchitectures=arm64-v8a FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:checkLocalDebugAarMetadata'.
> Could not resolve all files for configuration ':app:localDebugRuntimeClasspath'. > Failed to transform react-android-0.73.8-debug.aar (com.facebook.react:react-android:0.73.8) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Could not find react-android-0.73.8-debug.aar (com.facebook.react:react-android:0.73.8). Searched in the following locations: https://jcenter.bintray.com/com/facebook/react/react-android/0.73.8/react-android-0.73.8-debug.aar * Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org. BUILD FAILED in 4m 8s.
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Screenshot 2024-05-01 at 11 39 55 AM

Reproducible demo

N/A

FelipeSSantos1 commented 5 months ago

The problem was a old config that we had in our build.gradle, with that config it was trying to download from jcenter instead of from maven

allprojects {
    /*
        Repositories for the Android dependencies
    */
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
            // Android JSC is installed from npm
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven {
            // Detox configuration
            url("$rootDir/../node_modules/detox/Detox-android")
        }
        maven {
            url 'https://www.jitpack.io'
        }
        jcenter() // Keep JCenter in the last position, it's deprecated and less likely to have the dependencies we need
    }
}

the problem was in this block:

      mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }