How to get Manifest of an Android module...

Hi

I started to write a plugin that requires Android plugin.

Of course I can get the list of the modules and I try to get the facets to see which of them are based on Android.

I added Android plugin to the list of the dependencies and everything is compiling.

When I try to use the plugin I got the following error :
NoClassDefFoundError: org/jetbrains/android/facet/AndroidFacet: org/jetbrains/android/facet/AndroidFacet


The code is :

if (AndroidFacet.getInstance(module) != null){
//.....
}


Please help

I want two things:
1. To verify that is a Android Module and to check that is not a library.
2. To get the AndroidManifest and read/write data inside...

Thanks

Daniel

---
Original message URL: http://devnet.jetbrains.net/message/5514471#5514471

0

Add <depends>org.jetbrains.android</depends> to your plugin descriptor. See also http://devnet.jetbrains.com/message/5502539

0

Try this:

     final AndroidFacet facet = FacetManager.getInstance(module).getFacetsByType(AndroidFacet.ID);    
     final VirtualFile manifestFile = AndroidRootUtil.getManifestFile(facet);      if (manifestFile == null ||         !ReadonlyStatusHandler.ensureFilesWritable(facet.getModule().getProject(), manifestFile)) {       return;     }     final Manifest manifest = AndroidUtils.loadDomElement(facet.getModule(), manifestFile, Manifest.class);

0

Thanks..


I found it and it really helped ...
Now I can read the data inside.


I can also update it but I didn't find a way top make "save" the manifest.

            ApplicationManager.getApplication().runWriteAction( new Runnable() {
                @Override
                public void run() {

                    setNewValue(curManifest, newValue);

                }
            });

Can you please give a clue in that direction too ?

I got error :

llij.ide.plugins.PluginManager - Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor
com.intellij.util.IncorrectOperationException: Must not change document outside command or undo-transparent action. See com.intellij.openapi.command.WriteCommandAction or com.intellij.openapi.command.CommandProcessor


Thanks a lot..


Regards


Daniel

0
FacetManager.getInstance(module).getFacetsByType(AndroidFacet.ID);

is returning a collection of Facets...

0

请先登录再写评论。