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

二次信任 提交于 2019-12-17 18:05:23

问题


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)

回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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




回答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




回答6:


This removed the error for me:

File/Settings/Build, Execution, Deployment/Compiler

uncheck: Make project automatically




回答7:


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).




回答8:


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.



来源:https://stackoverflow.com/questions/55844077/findbugs-idea-classnotfoundexception-com-google-wireless-android-sdk-stats-int

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!