react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Null provider for dependency ':app:compileDebugJavaWithJavac' when building

Open FionaLMcLaren opened this issue 2 years ago • 2 comments

Description

Following up on this issue here: https://github.com/facebook/react-native/issues/38056. I have installed React Native on multiple devices with the same project as I am doing a university project and it works with everyone else's devices except for this case.

Here is the error...


* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not determine the dependencies of null.
   > Cannot query the value of this provider because it has no value available.

Here is the gradle scan... https://scans.gradle.com/s/ltphubeyhh5yw

Here is the results from react-native doctor...

Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ yarn - Required to install NPM dependencies
 ● Metro - Metro Bundler is not running

Android
 ✖ Adb - No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✓ Android SDK - Required for building and installing your app on Android

Errors:   1
Warnings: 1

(expected as I am running with ./gradlew build in the android folder instead of using npm start and starting up the emulator)

Here is the output for npx react-native info...

System:
  OS: Windows 11 10.0.22621
  CPU: (4) x64 Intel(R) Pentium(R) Silver N5030 CPU @ 1.10GHz
  Memory: 403.51 MB / 3.82 GB
Binaries:
  Node:
    version: 20.11.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.21
    path: ~\OneDrive\Documents\cs317-strath-walker\node_modules\.bin\yarn.CMD
  npm:
    version: 10.4.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 23.0.1
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Intel x86_64 Atom
      - android-34 | Google APIs Intel x86_64 Atom
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-231.9392.1.2311.11330709
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.10
    path: /c/Users/duffy/.jdks/corretto-17.0.10/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

I have tried building also with the npx create-expo-app AwesomeProject referenced in these instructions and encounter the same error, so I believe this is a less of a problem with how my project is set up.

This is my first time doing an issue report so if you need any more details/have done anything wrong, I'll get back as soon as I can! Thank you for any help!

Steps to reproduce

  1. Init any react-native project and use npm install to install any dependencies
  2. Go to the android directory (cd android) and run ./gradlew clean and then ./gradlew build

React Native Version

0.73.4

Affected Platforms

Runtime - Android, Build - Windows

Output of npx react-native info

System:
  OS: Windows 11 10.0.22621
  CPU: (4) x64 Intel(R) Pentium(R) Silver N5030 CPU @ 1.10GHz
  Memory: 403.51 MB / 3.82 GB
Binaries:
  Node:
    version: 20.11.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.21
    path: ~\OneDrive\Documents\cs317-strath-walker\node_modules\.bin\yarn.CMD
  npm:
    version: 10.4.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 23.0.1
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Intel x86_64 Atom
      - android-34 | Google APIs Intel x86_64 Atom
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-231.9392.1.2311.11330709
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.10
    path: /c/Users/duffy/.jdks/corretto-17.0.10/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not determine the dependencies of null.
   > Cannot query the value of this provider because it has no value available.

Reproducer

https://github.com/FionaLMcLaren/rn-app

Screenshots and Videos

image

FionaLMcLaren avatar Feb 23 '24 11:02 FionaLMcLaren

  • Init any react-native project and use npm install to install any dependencies
  • Go to the android directory (cd android) and run ./gradlew clean and then ./gradlew build

I'm not able to reproduce. I've checked your project and it builds fine on my end with Java 17. I'm unsure how to help you furhter

cortinico avatar Feb 23 '24 16:02 cortinico

Thank you, @cortinico , for your prompt reply. We are trying with a fresh reinstall as of now and looking into testing it on another machine too. Is there maybe anywhere you know where I could get more help - like if this is a Gradle problem, where would I go?

FionaLMcLaren avatar Feb 23 '24 17:02 FionaLMcLaren

UPDATE: We were able to fix the issue and get it running by uninstalling android studio and cleaning the device of any android installs and then doing a clean reinstall of android studio by following the "Setting up the Development Environment" guide on React Native's site. To uninstall android studio, we followed this stack overflow's instructions: https://stackoverflow.com/questions/39953495/how-to-completely-uninstall-android-studio-from-windowsv10

FionaLMcLaren avatar Feb 26 '24 13:02 FionaLMcLaren

UPDATE: We were able to fix the issue and get it running by uninstalling android studio and cleaning the device of any android installs and then doing a clean reinstall of android studio by following the "Setting up the Development Environment" guide on React Native's site. To uninstall android studio, we followed this stack overflow's instructions: stackoverflow.com/questions/39953495/how-to-completely-uninstall-android-studio-from-windowsv10

Great so closing because of this

cortinico avatar Mar 01 '24 02:03 cortinico