0

It seems like without any reason the Gradle refuses to build the project in Android Studio. I haven't change anything in the configurations and I can't find any reason of this error. The output is the following

Error:A problem occurred configuring project ':app'.
java.lang.ClassFormatError: Incompatible magic value 931269604 in class file build_f63dreec96sk8elmstb53lfie

No any Android library is recognized. So maybe there might be some problems with sdk but I have checked the dependencies and the path was set correctly. Here is a screenshot of my build.gradle.

enter image description here

I have already tried

1) rebuilding and cleaning the project.

2) File -> invalidate caches and restart

Are there any other ideas about fixing this problem. Thanks in advance

samvel1024
  • 1,123
  • 4
  • 15
  • 39

2 Answers2

2

For anyone who finds this in future. I had this issue and resolved it by typing:

gradlew --recompile-scripts

The problem was that Gradle had a precompiled build script from a previous version of Java. The .class file for that script was invalid, hence the error. You need to recompile that script.

davidfrancis
  • 3,734
  • 2
  • 24
  • 21
  • 1
    You could try clearing your gradle cache, I imagine you can google to find it. I'm on Windows so it's in my "C:\Users" user profile directory. – davidfrancis Nov 11 '16 at 16:00
0

Basically, you have a project or module that was compiled using a source JRE version less than a dependency.

Try the following

sourceCompatibility = 1.6 targetCompatibility = 1.6

More information is here Gradle sourceCompatibility has no effect to subprojects

Community
  • 1
  • 1
spy
  • 3,199
  • 1
  • 18
  • 26