4

I received this error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings remapped class cache for 1a8j0dwq37525yzi9alfmzw3 (C:\Users\Username\.gradle\caches\5.4.1\scripts-remapped\settings_7z9efzwj1mz1b0w35o6u5p4ep\1a8j0dwq37525yzi9alfmzw3\settingsdcd040730888da95d185715568c9cc57).
> Could not open settings generic class cache for settings file 'PATH\android\settings.gradle' (C:\Users\Username\.gradle\caches\5.4.1\scripts\1a8j0dwq37525yzi9alfmzw3\settings\settingsdcd040730888da95d185715568c9cc57).
   > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57

Yesterday I tried to add the Google Login Package and received similar errors. Then I pulled a working version from my Github Repository and now I get this error. Already cleaned Gradle, reinstalled Java, deleted Cache, "Restart and delete" with Android Studio... Has anybody an idea?

Thanks in advance

Mare Seestern
  • 317
  • 2
  • 12
  • 1
    For Flutter (might help in other frameworks) I have posted an answer on [this](https://stackoverflow.com/a/67541988/12349734) post. – MendelG May 14 '21 at 23:26

3 Answers3

2

Goto this directory :C:\Users\your username.gradle\caches Rename the gradle in question and then go and run 'react-native run-android' again your problem should be resolved!

2

For me, the removal of the cache didn't solve the problem.

I opened Android Studio and ran the Gradle build process. It downloaded the correct libraries and then react-native run-android ran flawlessly.

Amit
  • 1,641
  • 16
  • 25
2

Had the same problem. Here's how i solved this.

Go to android > gradle > > wrapper > gradle-wrapper.properties file and find distributionUrl and at the end of that line you'll find gradle-5.2-all.zip kind of gradle version. This version can be diffrent in your case. just change it to latest gradle version. In my case latest version is 6.7 so i changed version like this. Before

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-all.zip

After

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Nipun Ravisara
  • 2,319
  • 2
  • 14
  • 31