I am trying to add some new functionality to my plugin which should work on IntellijIDEA and AndroidStudio. Now I want to get the manifest file of an Android project and make some updates after that.. the problem is that I can't get the AndroidFacet object of the main module as it allways returned as null. Below is my code:
Module modules = ModuleManager.getInstance(ProjectManager.getInstance().getOpenProjects()).getSortedModules(); // get all the opened modules sorted by dependency
Module module = modules[modules.length-1]; // get the first module that is not used by other modules or is used by less than the others..
AndroidFacet facet = AndroidFacet.getInstance(module); // and here the facet object is allways null :(
Does anyone know what I am doing wrong? Why the
method returns allways null?
The opened android project has 4 modules, one is the main and the rest are lib modules. Using the above code I can get the proper module for my case as I could see it's name in debug mode. Also the project's modules are all Android facets..
Any help is much appreciated,