React Native Expo build getting error "Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'."

968 Views Asked by At

I have finished my react native codes and now I'm trying to build it for production but I get some errors. This is the bash code I'm using eas build --profile development --platform android. And the below are from Expo Builds page Run gradlew phase:

Running 'gradlew :app:assembleDebug' in /home/expo/workingdir/build/android

Downloading https://services.gradle.org/distributions/gradle-8.0.1-all.zip

10%.

20%.

30%.

40%.

50%.

60%

70%.

80%.

90%

100%

Welcome to Gradle 8.0.1!

Here are the highlights of this release:

 - Improvements to the Kotlin DSL

 - Fine-grained parallelism from the first build with configuration cache

 - Configurable Gradle user home cache cleanup

For more details see https://docs.gradle.org/8.0.1/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.0.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.

Daemon will be stopped at the end of the build

> Task :expo-updates-gradle-plugin:pluginDescriptors

> Task :expo-updates-gradle-plugin:processResources

> Task :gradle-plugin:pluginDescriptors

> Task :expo-dev-launcher-gradle-plugin:pluginDescriptors

> Task :gradle-plugin:processResources

> Task :expo-dev-launcher-gradle-plugin:processResources

> Task :expo-dev-launcher-gradle-plugin:compileKotlin

> Task :expo-dev-launcher-gradle-plugin:compileJava NO-SOURCE

> Task :expo-dev-launcher-gradle-plugin:classes

> Task :expo-dev-launcher-gradle-plugin:jar

> Task :expo-dev-launcher-gradle-plugin:inspectClassesForKotlinIC

> Task :gradle-plugin:compileKotlin

> Task :gradle-plugin:compileJava NO-SOURCE

> Task :gradle-plugin:classes

> Task :gradle-plugin:jar

> Task :gradle-plugin:inspectClassesForKotlinIC

> Task :expo-updates-gradle-plugin:compileKotlin

> Task :expo-updates-gradle-plugin:compileJava NO-SOURCE

> Task :expo-updates-gradle-plugin:classes

> Task :expo-updates-gradle-plugin:jar

> Task :expo-updates-gradle-plugin:inspectClassesForKotlinIC

> Configure project :app

 ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' ([email protected])

 ℹ️  Applying gradle plugin 'expo-updates-gradle-plugin' ([email protected])

> Configure project :expo-modules-core

Checking the license for package NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/licenses

License for package NDK (Side by side) 23.1.7779620 accepted.

Preparing "Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)".

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" ready.

Installing NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/ndk/23.1.7779620

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" complete.

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" finished.

Checking the license for package CMake 3.22.1 in /home/expo/Android/Sdk/licenses

License for package CMake 3.22.1 accepted.

Preparing "Install CMake 3.22.1 (revision: 3.22.1)".

"Install CMake 3.22.1 (revision: 3.22.1)" ready.

Installing CMake 3.22.1 in /home/expo/Android/Sdk/cmake/3.22.1

"Install CMake 3.22.1 (revision: 3.22.1)" complete.

"Install CMake 3.22.1 (revision: 3.22.1)" finished.

> Configure project :expo

Using expo modules

  - expo-application (5.3.0)

  - expo-constants (14.4.2)

  - expo-dev-client (2.4.11)

  - expo-dev-launcher (2.4.13)

  - expo-dev-menu (3.2.1)

  - expo-eas-client (0.6.0)

  - expo-file-system (15.4.4)

  - expo-font (11.4.0)

  - expo-json-utils (0.7.1)

  - expo-keep-awake (12.3.0)

  - expo-manifests (0.7.2)

  - expo-modules-core (1.5.11)

  - expo-modules-core$android-annotation (1.5.11)

  - expo-modules-core$android-annotation-processor (1.5.11)

  - expo-splash-screen (0.20.5)

  - expo-structured-headers (3.3.0)

  - expo-updates (0.18.16)

> Configure project :react-native-reanimated

No AAR for react-native-reanimated found. Attempting to build from source.

Android gradle plugin: 7.4.2

Gradle: 8.0.1

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.

Checking the license for package Android SDK Build-Tools 30.0.3 in /home/expo/Android/Sdk/licenses

License for package Android SDK Build-Tools 30.0.3 accepted.

Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".

"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" ready.

Installing Android SDK Build-Tools 30.0.3 in /home/expo/Android/Sdk/build-tools/30.0.3

"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" complete.

"Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)" finished.

Checking the license for package Android SDK Platform 33 in /home/expo/Android/Sdk/licenses

License for package Android SDK Platform 33 accepted.

Preparing "Install Android SDK Platform 33 (revision: 3)".

"Install Android SDK Platform 33 (revision: 3)" ready.

Installing Android SDK Platform 33 in /home/expo/Android/Sdk/platforms/android-33

"Install Android SDK Platform 33 (revision: 3)" complete.

"Install Android SDK Platform 33 (revision: 3)" finished.

FAILURE: Build failed with an exception.

* What went wrong:

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.

   > Could not resolve project :react-native-code-push.

     Required by:

         project :app

      > No matching configuration of project :react-native-code-push was found. The consumer was configured to find a component for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.4.2' but:

          - None of the consumable configurations have attributes.

* 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 3m 30s

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.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

15 actionable tasks: 15 executed

Keep in mind that it is the first time I'm building it and getting this error. I'm using Ubuntu 22.04LTS Operating System. I have tried npx expo prebuild but I got Could not get npm url for package "expo-template-bare-minimum@sdk-49" ✖ Failed to create the native project. You may want to delete the ./iosand/or./androiddirectories before trying again. this error.

I think problem's reason could be I should locate JDK in environment. I have put export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to ~/.bashrc. I don't know if I set it to environment right. I have investigated same problems in Stackoverflow and other platforms but none of the solutions worked for me.

1

There are 1 best solutions below

0
On

I was using JDK 8 changing JDK to 11 and removing react-native-code-push(I was not using this package) just resolved it but there was more problems I am writing down other think could be helpful.

I have solved other problem npx expo prebuild with downgrading my node.js version to 16. While building mergelibdexdebug was giving me the error that I have duplicated file in it. I had two clipboard packages @react-native-clipboard/clipboad and @react-native-community/clipboard. Just remove @react-native-community/clipboard cause I think it just stopped support. It fixed my issues.