25

Android Studio 3.4.

Project SDK (Android API 19 Platform).

Not using FindBugs or SpotBugs.

Every attempt to build, I get this error:

Information:9/05/2019 4:02 PM - Compilation completed with 1 error and 0 warnings in 1 s 763 ms
Error:Internal error: (java.lang.ClassNotFoundException) com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index
java.lang.ClassNotFoundException: com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.intellij.util.indexing.counters.IndexCounters.<clinit>(IndexCounters.java:34)
    at com.intellij.util.indexing.impl.MapReduceIndex.<init>(MapReduceIndex.java:86)
    at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex$CompilerMapReduceIndex.<init>(CompilerReferenceIndex.java:214)
    at org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex.<init>(CompilerReferenceIndex.java:73)
    at org.jetbrains.jps.backwardRefs.JavaCompilerBackwardReferenceIndex.<init>(JavaCompilerBackwardReferenceIndex.java:12)
    at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexWriter.initialize(JavaBackwardReferenceIndexWriter.java:74)
    at org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexBuilder.buildStarted(JavaBackwardReferenceIndexBuilder.java:40)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:358)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:229)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Vince Refiti
  • 483
  • 1
  • 5
  • 9
  • 1
    I have the same, problem appeared out of the blue today without having changed a line of code. New bug in AS 3.4 ? – michaelsmith May 14 '19 at 16:20
  • Hi, are you able to fix this issue? – Ajay Naredla Aug 16 '19 at 13:17
  • Possible duplicate of [Intellij Error: Internal caches are corrupted or have outdated format](https://stackoverflow.com/questions/19480480/intellij-error-internal-caches-are-corrupted-or-have-outdated-format) – Heath Borders Oct 29 '19 at 02:33

6 Answers6

8

Solved for me, finally, after months. Note that I have never used FindBugs or SpotBugs, although most posts related to this error mention it.

The solution is to change the compiler from javac to Eclipse. I followed the picture here (don't worry if you don't read Chinese; you won't need to; the picture just makes it clear how to change the compiler).

I have no idea why this works and would highly appreciate informed commentary.

user1236910
  • 203
  • 3
  • 8
  • Although this error gone, a new one appears: java.lang.NoClassDefFoundError: com/android/resources/ResourceFolderType – user2305886 Sep 03 '20 at 23:29
1

I am facing the same issue with android studio 3.4 and 3.4.1 as well but this work fine with android studio 2.3.3 and 3.0 as well.

1

Bug seems to be in Android Studio 3.4.x so I downloaded beta version of Android Studio 3.5 and error is gone.

You can download preview version from here :

https://developer.android.com/studio/preview/index.html

Abhishek Aryan
  • 19,936
  • 8
  • 46
  • 65
0

Partial and temporary fix.

I downgraded Android Studio to 2.3.3 (!) and it worked. I will need to track down what is hard-linking the project to this particular version and fix that, but I need to ship a fix now for the issue at hand.

Vince Refiti
  • 483
  • 1
  • 5
  • 9
0

I get this error message in a Flutter project, when I try to build the project (menu Build/Make Module) whith Android Studio 3.4.2. But I don't get the error when I run the app (menu Run/Run). Running the app does build the project correctly. It seems that menu Build/Make module does not build the app correctly... So, the solution for me is to run the app, not build it ;-)

Dazzibao
  • 590
  • 3
  • 7
-1

Solution

I was able to fix this problem by deleting the system subfolder in Android Studio's configuration folder. No user data is lost and the build starts working again!

Android Studio configuration folder can be found under this locations (for more information see this question):

  • Linux / MacOSX: /home/USERNAME/.AndroidStudio
  • Windows: C:/Users/USERNAME/.AndroidStudio

Note that the name of the configuration folder can vary based on the version: it could be .AndroidStudio3.5, .AndroidStudioBeta or others.

Cause

This problem is most probably caused by some corrupted/invalid gradle build files in your project, that cause the system-wide Android Studio configuration to break. So if the problem shows up again after using the solution above, remove cache and build files generated by gradle by following these steps:

  • ./gradlew clean (Linux/MacOS) or .\gradlew.bat clean (Windows): this should work, as it should clean all files generated by gradle.
  • If you are in a git repository try to remove all untracked files (but please note that this could delete files you want to keep... be sure to commit them first!)
  • Manually delete build folders, in case the above steps did not work.
Stypox
  • 963
  • 11
  • 18