Skip to content

Could not determine the dependencies of task ':app:compileDevelopmentDebugJavaWithJavac'. #36198

@xeroxoid

Description

@xeroxoid

New Version

0.71.3

Old Version

0.70.6

Build Target(s)

Android in all favors

Output of react-native info

System:
    OS: macOS 13.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 30.74 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/Library/Caches/fnm_multishells/39370_1676644845725/bin/node
    Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/39370_1676644845725/bin/yarn
    npm: 9.4.0 - ~/Library/Caches/fnm_multishells/39370_1676644845725/bin/npm
    Watchman: 2022.11.14.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/milt/.rvm/gems/ruby-2.7.6/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 30, 31, 33
      Build Tools: 30.0.3, 31.0.0, 33.0.0
      System Images: android-31 | Google APIs Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.3 => 0.71.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Issue and Reproduction Steps

After updating to react-native 0.71 using the upgrade helper the android build fails.

This is the output:

$ npx react-native run-android --variant=developmentDebug --appIdSuffix 'development'
info Starting JS server...
warn "variant" flag is deprecated and will be removed in future release. Please switch to "mode" flag.
info Installing the app...

> Configure project :app
Reading env from: .env.development

> Configure project :lottie-react-native
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Configure project :react-native-auth0
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at ...path-to-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:firebase.bom using default value: 30.1.0
:react-native-firebase_app:play.play-services-auth using default value: 20.2.0
:react-native-firebase_app package.json found at ...path-to-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_app:version set from package.json: 14.11.1 (14,11,1 - 14011001)
:react-native-firebase_app:android.compileSdk using custom value: 33
:react-native-firebase_app:android.targetSdk using custom value: 33
:react-native-firebase_app:android.minSdk using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir ...path-to-app/node_modules/react-native/android

> Configure project :react-native-firebase_dynamic-links
:react-native-firebase_dynamic-links package.json found at ...path-to-app/node_modules/@react-native-firebase/dynamic-links/package.json
:react-native-firebase_app package.json found at ...path-to-app/node_modules/@react-native-firebase/app/package.json
:react-native-firebase_dynamic-links:firebase.bom using default value: 30.1.0
:react-native-firebase_dynamic-links package.json found at ...path-to-app/node_modules/@react-native-firebase/dynamic-links/package.json
:react-native-firebase_dynamic-links:version set from package.json: 14.11.1 (14,11,1 - 14011001)
:react-native-firebase_dynamic-links:android.compileSdk using custom value: 33
:react-native-firebase_dynamic-links:android.targetSdk using custom value: 33
:react-native-firebase_dynamic-links:android.minSdk using custom value: 21
:react-native-firebase_dynamic-links:reactNativeAndroidDir ...path-to-app/node_modules/react-native/android

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
...path-to-app/node_modules/react-native-reanimated/android/react-native-reanimated-71-hermes.aar

> Configure project :react-native-vision-camera
VisionCamera: node_modules/ found at: ...path-to-app/node_modules
VisionCamera: Building with Hermes...
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
VisionCamera: Frame Processors are enabled! Building C++ part...
WARNING:DSL element 'dexOptions' is obsolete and should be removed.
It will be removed in version 8.0 of the Android Gradle plugin.
Using it has no effect, and the AndroidGradle plugin optimizes dexing automatically.

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

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

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDevelopmentDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:developmentDebugCompileClasspath'.
   > Cannot resolve external dependency com.facebook.flipper:flipper:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.flipper:flipper-network-plugin:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.flipper:flipper-fresco-plugin:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.react:react-android because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.react:hermes-android because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.bugsnag:bugsnag-android:5.28.3 because no repositories are defined.
     Required by:
         project :app > project :bugsnag_react-native
   > Cannot resolve external dependency com.bugsnag:bugsnag-plugin-react-native:5.28.3 because no repositories are defined.
     Required by:
         project :app > project :bugsnag_react-native
   > Cannot resolve external dependency com.facebook.react:react-native:+ because no repositories are defined.
     Required by:
         project :app > project :react-native-community_art
         project :app > project :react-native-community_cameraroll
         project :app > project :react-native-firebase_app
         project :app > project :react-native-firebase_dynamic-links
         project :app > project :react-native-picker_picker
   > Cannot resolve external dependency com.onesignal:OneSignal:4.8.2 because no repositories are defined.
     Required by:
         project :app > project :react-native-onesignal
   > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 because no repositories are defined.
     Required by:
         project :app > project :react-native-screens

* 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 14s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDevelopmentDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDevelopmentDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:developmentDebugCompileClasspath'.
   > Cannot resolve external dependency com.facebook.flipper:flipper:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.flipper:flipper-network-plugin:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.flipper:flipper-fresco-plugin:0.125.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.react:react-android because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.facebook.react:hermes-android because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.bugsnag:bugsnag-android:5.28.3 because no repositories are defined.
     Required by:
         project :app > project :bugsnag_react-native
   > Cannot resolve external dependency com.bugsnag:bugsnag-plugin-react-native:5.28.3 because no repositories are defined.
     Required by:
         project :app > project :bugsnag_react-native
   > Cannot resolve external dependency com.facebook.react:react-native:+ because no repositories are defined.
     Required by:
         project :app > project :react-native-community_art
         project :app > project :react-native-community_cameraroll
         project :app > project :react-native-firebase_app
         project :app > project :react-native-firebase_dynamic-links
         project :app > project :react-native-picker_picker
   > Cannot resolve external dependency com.onesignal:OneSignal:4.8.2 because no repositories are defined.
     Required by:
         project :app > project :react-native-onesignal
   > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 because no repositories are defined.
     Required by:
         project :app > project :react-native-screens

* 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 14s

    at makeError (...path-to-app/node_modules/execa/index.js:174:9)
    at ...path-to-app/node_modules/execa/index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (...path-to-app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
    at async Command.handleAction (...path-to-app/node_modules/@react-native-community/cli/build/index.js:108:9)

Also here is the adapted build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
        googlePlayServicesVersion = "16.0.0"
        googlePlayServicesVisionVersion = "17.0.2"
        kotlinVersion = "1.6.20"  // fix for vision-camera gradle plugin version
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("com.google.gms:google-services:4.3.10")
        classpath("com.bugsnag:bugsnag-android-gradle-plugin:7.+")
    }
}

allprojects {
    // START - for react-native-reanimated v1 and rn 0.70.x
    subprojects { subproject ->
        if(project['name'] == 'react-native-reanimated'){
            project.configurations { compile { } }
        }
    }
    // END - for react-native-reanimated v1 and rn 0.70.x
}

and here is the app/build.gradle:

project.ext.envConfigFiles = [
    development: ".env.development",
    staging: ".env.staging",
    production: ".env.production",
]

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
    /* Folders */
    //   The root of your project, i.e. where "package.json" lives. Default is '..'
    // root = file("../")
    //   The folder where the react-native NPM package is. Default is ../node_modules/react-native
    // reactNativeDir = file("../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
    // codegenDir = file("../node_modules/react-native-codegen")
    //   The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
    // cliFile = file("../node_modules/react-native/cli.js")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["developmentDebug", "stagingDebug", "productionDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]
    //
    //   The command to run when bundling. By default is 'bundle'
    // bundleCommand = "ram-bundle"
    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]
}

/**
 * Set this to true to create four separate APKs instead of one,
 * one for each native architecture. This is useful if you don't
 * use App Bundles (https://developer.android.com/guide/app-bundle/)
 * and want to have separate APKs to upload to the Play Store.
 */
def enableSeparateBuildPerCPUArchitecture = true

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = false // Warning: enabling this seems to break the release variant

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US. Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Private function to get the list of Native Architectures you want to build.
 * This reads the value from reactNativeArchitectures in your gradle.properties
 * file and works together with the --active-arch-only flag of react-native run-android.
 */
def reactNativeArchitectures() {
    def value = project.getProperties().get("reactNativeArchitectures")
    return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def storeFileProp = properties.getProperty('MYAPP_RELEASE_STORE_FILE')
def storePasswordProp = properties.getProperty('MYAPP_RELEASE_STORE_PASSWORD')
def keyAliasProp = properties.getProperty('MYAPP_RELEASE_KEY_ALIAS')
def keyPasswordProp = properties.getProperty('MYAPP_RELEASE_KEY_PASSWORD')

android {
    ndkVersion rootProject.ext.ndkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion
    namespace project.env.get("ANDROID_APP_ID")
    defaultConfig {
        applicationId project.env.get("ANDROID_APP_ID")
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 46
        versionName "1.7.6"
        resValue "string", "build_config_package", "com.package.name" // for react-native-config
        resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) // for react-native-codepush
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // If true, also generate a universal APK
            include (*reactNativeArchitectures())
        }
    }
    flavorDimensions "environment"
    productFlavors {
        development {
            applicationIdSuffix ".development"
            manifestPlaceholders = [
                bugsnagApiKey: project.env.get("BUGSNAG_API_KEY"),
                auth0Domain: project.env.get("AUTH0_DOMAIN"),
                auth0Scheme: project.env.get("ANDROID_APP_ID") + "${applicationIdSuffix}"
            ]
        }
        staging {
            applicationIdSuffix ".staging"
            manifestPlaceholders = [
                bugsnagApiKey: project.env.get("BUGSNAG_API_KEY"),
                auth0Domain: project.env.get("AUTH0_DOMAIN"),
                auth0Scheme: project.env.get("ANDROID_APP_ID") + "${applicationIdSuffix}"
            ]
        }
        production {
            applicationIdSuffix ""
            manifestPlaceholders = [
                bugsnagApiKey: project.env.get("BUGSNAG_API_KEY"),
                auth0Domain: project.env.get("AUTH0_DOMAIN"),
                auth0Scheme: project.env.get("ANDROID_APP_ID") + "${applicationIdSuffix}"
            ]
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            storeFile file(storeFileProp)
            storePassword storePasswordProp
            keyAlias keyAliasProp
            keyPassword keyPasswordProp
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

dependencies {
    implementation project(':lottie-react-native')

     // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: AnsweredWhen the issue is resolved with a simple answerType: Upgrade IssueIssues reported from upgrade issue form

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions