【ClassNotFoundException】After upgrading android studio to the latest version, my plugin reports an error

Answered

Caused by: java.lang.ClassNotFoundException: com.android.layoutinspector.model.ClientWindow PluginClassLoader(plugin=PluginDescriptor(name=LayoutVerify, id= , descriptorPath=plugin.xml, path=E:\ALM\LayoutVerify1\LayoutVerifyPlugin\build\idea-sandbox\plugins\LayoutVerify, version=1.0-SNAPSHOT, package=null, isBundled=false), packagePrefix=null, instanceId=78, state=active)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:235)
Caused by: java.lang.ClassNotFoundException: com.android.layoutinspector.model.ClientWindow PluginClassLoader(plugin=PluginDescriptor(name=LayoutVerify, id=com..LayoutVerify, descriptorPath=plugin.xml, path=E:\ALM\LayoutVerify1\LayoutVerifyPlugin\build\idea-sandbox\plugins\LayoutVerify, version=1.0-SNAPSHOT, package=null, isBundled=false), packagePrefix=null, instanceId=78, state=active)

0
10 comments

Hi,

Please be more specific. What is your Gradle build script? What was the previous and new version?

0

 

old studio version  

This problem does not appear in older versions

0

I have now updated the dependency to the latest 2022.2.3 version, and under this version, it can still be found in "com.android.layoutinspector.model"
You can see the ClientWindow class in this path. But the latest code in studio does not see this class under the branch studio-2020.3.1, this class exists under the branch master
How to use this class correctly in the latest Android studio version

 

0

Hi,

This class is available in the setup from your first build script screenshot (IC 2021.3 + "android" plugin). Maybe you didn't reimport the project, or something went wrong.

0

After the build file is updated, the corresponding local dependency package is also updated. No error will be reported during the compilation process. An error will be reported only after the plugin runs to the latest android studio. This class seems to no longer exist in the latest android studio environment. .

 

0

Please help to answer this question, thanks

0

810829096, I confused. Are you developing a plugin for Android Studio or IDEA?

IDEA 2022.1 is not the same as Android Studio 2022.1. It is easier to comprehend if we denote 2 parts explicitly: there is Android Plugin (AP) and IJ platform (IJ)

  • IDEA 2021.3 = IJ-2021.3 + AP-2020.3 (Arctic Fox)
  • Android Studio 2021.3 = IJ-2021.3 + AP-2021.3 (Dolphin)
  • IDEA 2022.1 = IJ-2022.1 + AP-2020.3 (Arctic Fox) (yes, android plugin didn't change between IDEA 2021.3 and 2022.1)
  • Android Studio 2022.1 = IJ-2022.1 + AP-2022.1 (Electric Eel)
  • IDEA 2022.2 = IJ-2022.2 + AP-2021.2 (Chipmunk) (yes, we skipped Bumblebee and jumped to Chipmunk immediately)
  • Android Studio 2022.2 = IJ-2022.2 + AP-2022.2 (Flamingo)
  • IDEA 2022.3 = IJ-2022.3 + AP-2022.1 (Electric Eel) (yes, we skipped Dolphin and jumped to Electric Eel immediately)
  • Android Studio 2022.3 = IJ-2022.3 + AP-2022.3 (The animal after Flamingo, not yet known)

You can always find which Android plugin is integrated into IDEA through settings|plugins:

If your target platform is Android Studio, please use Android Studio itself for development:

intellij {
localPath.set("/full/path/to/android/studio")
plugins.set(listOf("android"))
}

In general, plugin developed for IC-a.b.c is not compatible with AS-a.b.c, and vise versa. You need 2 different plugins for 2 different IDEs in most cases.

It seems ClientWindow has been deleted in EE (maybe in Dolphin). I didn't find exact commit where this happened, but this commit implies that legacy-layout-inspector has gone and you need to use some different APIs: https://android.googlesource.com/platform/tools/adt/idea/+/1362c00fb1d73482deede80edf3b9e7af11dcc22

0

I just found that now we support `AI` product codes: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type

So you can use `AI` instead of `IC` or `localPath`

0

Thank you for your answer. First of all, my plugin is for Android studio. My question is why there is this class in the developed dependency package but not in the actual Android studio runtime environment. If this path has been deleted in the actual environment, why  Do not delete together in dependent packages? code 'AI' doesn't seem to be supported

0

Hi, regarding the support for AI, you need to use the latest Gradle IntelliJ Plugin.

0

Please sign in to leave a comment.