NullPointerException using plugin in Android Studio

Answered

I developed a plugin for Android Studio. First I tested only in IntelliJ. Everything works. Now I started testing on Android Studio. When I tap on the action, it doesn't execute it and shows this instead:

java.lang.NullPointerException
at com.android.tools.idea.diagnostics.AndroidStudioSystemHealthMonitor.getActionName(AndroidStudioSystemHealthMonitor.java:744)

...

The action never starts - I put a `println` at the top of `actionPerformed` and it doesn't show up.

I have no idea what to do and couldn't find anything useful about this.

This is in my build.gradle, in order to start Android Studio instead of IntelliJ:

 

intellij {
version '2018.3.5'
pluginName 'My plugin'
alternativeIdePath '/Applications/Android Studio.app'
}

 

My IntelliJ version:

IntelliJ IDEA 2018.3.5 (Community Edition)
Build #IC-183.5912.21, built on February 26, 2019
JRE: 1.8.0_152-release-1343-b28 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3

 

My Android Studio version:

Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3

 

Now, I read somewhere that it's recommended that the used IntelliJ version is the same to the IntelliJ version Android Studio is based on. So, since Android Studio says it's based on 2018.2, I downloaded the current 2018.2.7 (don't see 2018.2.0 in the downloads in case this is what Android Studio wants...). But same result.

Another peculiarity is that when running Android Studio (either from IntelliJ 2018.3.5 or 2018.2.7) the complete menu bar (top bar) (of Android Studio) is dead. I can open menus but clicking on them (e.g. File > about, File > Open, Help > find action, etc) doesn't do anything. The menu bar works perfectly when I run IntelliJ instead of Android Studio.

What's going on? And is this only a debugging issue or will this plugin also crash if it's installed normally?

Here's a repository with the source code: https://github.com/i-schuetz/dart_copy_with_plugin

Thanks.

 

1
2 comments

I solved the null pointer. The problem apparently was that my classes were not in a package.

3

Thanks, you saved me finally. Such a stupid thing wasted my numerous hours

0

Please sign in to leave a comment.