1. Get the library jar from your phone, using the ADB (Android Debugger Bridge). It will be in /system/framework somewhere. In my case it was the file fmreceiverif.jar.
2. Unpack the jar and get the classes.dex file.
3. Use dex2jar to convert this file to a jar file, i.e. convert the Dalvik VM code into a regular Java VM byte code.
4. Use jd-gui to get the source files from the jar. In the jave source files there will be the name of the package which is of interest to your app (e.g com.sonyericsson.fmradio).
5. Unpack your ‘target’ android jar file which comes with the SDK (it will be specific for your Android platform).
6. Add the jar file (the one you got after running dex2jar) into the proper place.
7. Use this same tree, which now contains the lib’s jar to create a new, “extended” android jar.
8. Build your app against this new android jar.
9. Use ADB to install the app on your phone and test it.
NOTE : The good thing about this method is that you DO NOT NEED ROOT to do this! 🙂
NOTE : If you simply drop the lib jar under your app directory tree it will add the lib jar into the apk. This often will not be what you want as there may be classes/functions in the lib which need to be run as part of the android environment, to run with specific permissions and loading the jar as part of the app will not provide the necessary level of access and you will get an exception.
One Response to Creating an Android app which uses a provider library
Leave a Reply Cancel reply
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- August 2020
- August 2019
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum
Highly descriptive article, I enjoyed that bit.
Will there be a part 2?
Also visit my site … developing apps for android