1. Create an android Application normally
2. Set the main application project of the OSGI framework as the reference project of the bundle. In eclipse, go to build path-> configure build path-> projects to set.
3. create and generate manifest. mf. you can use the bndtools plug-in of eclipse or its original version bnd. jar to automatically generate the file (bndtools seems to have a bug, and I cannot use it to generate the correct manifest. mf and jar packages, but bnd. jar can. The command line I used is: java-jar bnd-2.1.0.jar buildx -- classpath bin -- eclipse -- output test. jar bnd. bnd ).
4. Go to android tools> Export unsigned Android package to Export the unsigned android APK file.
5. Use any zip tool such as 7zip to open apk, create a new folder: META-INF, and copy the generated manifest. mf to this folder
6. Upload the java class file generated by the project to the root directory of the apk.
7. Use the java signature tool to sign the APK File
Jarsigner-verbose-keystore/path_to_keystore/mykeystore. keystore my_application.apk my_keystore_alias.
8. Install the apk on emulator or device, and install the OSGI framework to start the bundle.