FindBugs IDEA - ClassNotFoundException com.google.wireless.android.sdk.stats.IntellijIndexingStats
AndroidFindbugsAndroid Problem Overview
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)
Android Solutions
Solution 1 - Android
To Solve this problem in Android Studio go to:
File
-> Settings
-> Build, Execution, Deployment
-> Compiler
-> Java Compiler
Change javac
to eclipse
, and apply.
Solution 2 - Android
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.
Solution 3 - Android
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.
> 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.
Solution 4 - Android
open the FindBugs setting, click General,then close the "Compile affected files before analyze". It works for me with Android Studio 3.5
Solution 5 - Android
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.
Solution 6 - Android
This removed the error for me:
File/Settings/Build, Execution, Deployment/Compiler
uncheck: Make project automatically
Solution 7 - Android
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).
Solution 8 - Android
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.
Solution 9 - Android
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