title: React-Native error when starting Android studio Task :app:compileDebugJavaWithJavac FAILED
body: <p>I am new to App Development and React-native, I am trying to start the Emulator for Android studio using 'npx react-native run-android' in VS Code, No matter what I do I always get the Following error:</p>
  <pre><code>Starting a Gradle Daemon (subsequent builds will be faster)
  
  &gt; Task :app:compileDebugJavaWithJavac FAILED
  15 actionable tasks: 2 executed, 13 up-to-date
  Note: C:\Users\User\Testing\android\app\src\debug\java\com\testing\ReactNativeFlipper.java uses or overrides a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:compileDebugJavaWithJavac'.
  &gt; java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x247a2315) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x247a2315
  
  * 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 15s
  
  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.bat app:installDebug -PreactNativeDevServerPort=8081
  Note: C:\Users\User\Testing\android\app\src\debug\java\com\testing\ReactNativeFlipper.java uses or overrides a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:compileDebugJavaWithJavac'.
  &gt; java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x247a2315) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x247a2315
  
  * 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 15s
  
      at makeError (C:\Users\User\Testing\node_modules\execa\index.js:174:9)
      at C:\Users\User\Testing\node_modules\execa\index.js:278:16
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async runOnAllDevices (C:\Users\User\Testing\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
      at async Command.handleAction (C:\Users\User\Testing\node_modules\@react-native-community\cli\build\index.js:186:9)
  info Run CLI with --verbose flag for more details.
  </code></pre>
  <p>This is my build.gradle file:</p>
  <pre><code>buildToolsVersion = &quot;29.0.3&quot;
  minSdkVersion = 21
  compileSdkVersion = 29
  targetSdkVersion = 29
  ndkVersion = &quot;20.1.5948944&quot;
  </code></pre>
  <p>I am genuinely stuck at this point any help would be greatly appreciated</p>