How to check if the project is of Jetpack Compose in Android Studio plugin?
Answered
I am currently creating an Android Studio plugin. I have a custom editor which works with both Java and Kotlin files. However, I don't want the editor to be shown when the project is of Jetpack Compose, as Android Studio already has a custom editor for compose preview which works with Kotlin files. So, if the project is of Jetpack Compose, then my editor should not be shown in Kotlin files. So, how can I check if the opened project in Android Studio is of Jetpack Compose or not?
Please sign in to leave a comment.
Hi,
Regarding detecting the current product, use information from com.intellij.openapi.application.ApplicationNamesInfo.fullProductName().
Regarding the Jetpack Compose, I suggest checking if it is part of the project dependencies. To do this you can use AndroidModuleSystem retrieved with com.android.tools.idea.projectsystem.ProjectSystemService.projectSystem.getModuleSystem(module).
Thanks! It works!