Wednesday, October 5, 2011

Create your own shared-library

Below is the step of creating own shared-library:

  1. Create JAVA file, ex: c:\com.myactivity.java
  2. Compress to JAR, with command: jar cf c:\com.myactivity.jar c:\com.myactivity.java
    • JAR is our library file.
  3. Create XML file (permission file), ex: c:\com.myactivity.xml, as below:
    <permissions>
    <library name="com.myactivity" file="/system/framework/com.myactivity.jar" />
    </permissions> 
  4. Root the OS image: adb root (We assume that the image can be rooted.)
  5. Mount /system, commands are as belows:
    adb shell
    mount –o remount /system
    exit 
  6. Push JAR and XML file to OS image:
    adb push c:\com.myactivity.jar /system/framework/
    adb push c:\com.myactivity.xml /system/etc/permissions/ 
  7. Reboot device.
  8. After rebooted, the shared-library can be used correctly.
  9. Try using to test the library.
    <uses-library android:name="com.myactivity" android:required="true" /> 

No comments:

Post a Comment