FindBugs IDEA - ClassNotFoundException com.google.wireless.android.sdk.stats.IntellijIndexingStats

FindBugs IDEA v1.0.1 Android Studio 3.4

I get this error when running FindBugs. I don't use com.google.wireless.android.sdk anywhere in the app.

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)
58643 次浏览

I think this may be the answer.

SpotBugs is the spiritual successor of FindBugs, carrying on from the point where it left off with support of its community.

The FindBugs Plugin

Since FindBugs is unmaintained and does not support bytecode compiled for Java 9 and above, the FindBugs plugin has been deprecated and is scheduled to be removed in Gradle 6.0. Please consider using the SpotBugs plugin instead.

You should have at least 512 MB of memory to use SpotBugs. To analyze very large projects, more memory may be needed.

Very important issue Unable to use Spotbugs in Android application.

This solution is based on the assumption that You use Android Studio for Flutter and Android both. Each time I close Flutter project and open up Android project I need to configure android Sdk else it gives me this error:

Error:Internal error: (java.lang.ClassNotFoundException)
com.google.wireless.android.sdk.stats.IntellijIndexingStats$Index

Simply go to the LogCat and Click on the "Please configure Android SDK" and select the latest Build Tools Version 28.0.3 I guess( or whatever is your latest build version) from the dropdown.

open the FindBugs setting, click General,then close the "Compile affected files before analyze". It works for me with Android Studio 3.5

I faced similar error with JDK 1.8. The error was caused by a missing keystore file. Try generating new keystore using a keytool from JDK 12. This worked for me.

Also add some dependencies and maven repositories according to yout gradle version may be also need to AndroidAnnotations version:

4.3.1

Android compile SDK version:

25

This removed the error for me:

File/Settings/Build, Execution, Deployment/Compiler

uncheck: Make project automatically

For what it's worth i got this exact error by importing a project started with IntelliJ Pro and imported into Android Studio - deleting the .idea directory at the root of the project and re-importing the project with Android Studio cleared it.

I got this error in Android Studio without running FindBugs.

I initially saw an IntelliJ post suggesting I disable compiler-based indexing in the IntelliJ registry to stop the error:

as a workaround for the exception you may set compiler.ref.index = false in Registry (ctrl+alt-shift+/ or via "find action by name" action)

However, I didn't want to settle for losing compiler-based indexing, after doing an Invalidate Caches / Restart..., I saw the following message:

Internal caches are corrupted or have outdated format, forcing project rebuild

That message led me to pdinklag's answer, which I modified slightly for Android Studio

I shut down Android Studio, then ran:

rm -rf ~/.android
rm -rf <PROJECT_ROOT>/.idea

Then restarted Android Studio, and things worked.

Seems that FindBugs is not able to compile the files before analyze.

In Android Studio, go to FindBugs settings (found under File > Settings > Other Settings), and UNCHECK "Compile affected files before analyze".

When you do this, then you need to compile files yourself (by building and running the app, for example), or FindBugs analyze uses old file data (from the previous build).

To Solve this problem in Android Studio go to:

File
-> Settings
-> Build, Execution, Deployment
-> Compiler -> Java Compiler

Change javac to eclipse, and apply.