How to compile one Java library only from /external directory in AOSP - Miscellaneous Android Development

I am doing some modifications to okhttp library in AOSP. The library exists in this location in in AOSP: /external/okhttp
I know that the library will become a jar file okhttp.jar after I compile the AOSP. but compiling the whole AOSP take a long time. So I am wondering if there is an easy way to compile the okhttp library alone and get the jar file.

Related

Launcher2 compiling/eclipse problems

ok guys i am trying to compile Launcher2 from source i am running ubuntu 9.1, with eclipse(for jave ee) 3.5.1 and adt installed. i have downloaded the source from google. Launcher2 though is not sent when syncing repo, so i got the Launcher2 source from cyanogen. As far as i figure unless i missed something i should be able to click file > new project > android project. this brings up a window, click the bullet load from source choose the directory where Launcher2 is and choose API level 7 then click finish. it loads with 2 errors, cannot compile until build paths are fixed and that the folder "gen" isn't there. "gen" is an auto-generated folder by eclipse that follows after the source code to fix those errors, you either make a change or delete the gen folder. since the gen folder is auto-generated deleting it just forces the gen folder to be remade to make the compiler happy. when that happens approximately 184 errors occur(they were there all along) the gen files were just hiding them.
what i am trying to figure out is what i need to do to get this to compile? am i missing a step in the process? am i missing something? i've been banging my head against this wall for about 2 weeks looking for every possible angle that i can think of including putting Launcher2 into it's respective folder made by git and running make. it errored out. i'm at a loss and any kind of help would be greatly appreciated.
i would like to add, this is straight from cyanogens github no modifications and no changes. also no modifications or changes to any files aquired by repo. i'm just trying to compile a "stock" Launcher2, once i am able to compile that i will rercompile with any changes i might want to make.

how to compile libfuse on android?

I want to use FUSE in android. It's easy to compile the kernel part by enabling FUSE in .config, but how to compile libfuse.a/.so?
I tried to put it in <platform>/external/ and create an Android.mk according to fuse's Makefile.am. However, lots of header files are missed, such as <sys/statvfs.h>. After copying lost headers to bionic, there are so many conflicts and complicated dependencies.
anyone has tried it?

[Q] decompiling java/ recompiling

I can take dex files and decompiling them to smali assembler and make changes there but it is much harder to read than java. I have been able to decompiling to sTraight java but then once I have made a change, I can't figure out how to compile just the single java back to a class without recreating the entire project in eclipse. Is there a way to just compile that single file I changed and insert it back in?
Sent from my Inspire '4g'.
How did you decompiled dex file?
You can't compile it back just like that, but you could use some workaround:
If you reference in Java some other classes from dex, then you will have to create Java stubs for these classes.
Compile your java class, linking to above stubs and android.jar file (javac).
dex resulting *.class files (dx tool).
baksmali resulting classes.dex.
baksmali original dex file.
replace smali files with new ones.
smali everything back to classes.dex form.
You could also read this: http://code.google.com/p/android-apktool/issues/detail?id=88

[Q] how to compile libaudio.so module? [CM7]

Original post: forum.cyanogenmod.com/topic/41583-hello-hello-bug-cant-hear-caller/
It seems like I'm suffering from this bug
code.google.com/p/cyanogenmod/issues/detail?id=4681
although I found the commit
github.com/CyanogenMod/android_device_samsung_crespo/commit/49cb776c1a5d056c345d90465f8006ef23d947b0#libaudio/AudioHardware.cpp
which (hopefully) fixed this bug but the commit only merged into ics branch not gb branch (CM7).
I got cygwin and NDK set up, but I have no idea how exactly to compile libaudio.so module.
After selecting your target, enter:
Code:
make audio.primary.herring
from cygwin?
the target is the libaudio folder, right?
does it involve NDK?
I also need library file (libhardware_legacy.so, libcutils.so, libmedia.so, etc) isn't it? I have the files, where do I put those files?
gleenfield97 said:
from cygwin?
the target is the libaudio folder, right?
does it involve NDK?
I also need library file (libhardware_legacy.so, libcutils.so, libmedia.so, etc) isn't it? I have the files, where do I put those files?
Click to expand...
Click to collapse
Your target should be listed in the set of options before you begin building. In this case, it's crespo or crespo4g for the Nexus S or Nexus S 4G, respectively. If you need to build other modules, locate the Android.mk file for the module you want to build and locate the value under LOCAL_MODULE. The destination for the file(s) in question will be printed after the build is completed. What happens from there depends on what you intend to do with it.
Getting familiar with the build system will make things much more easier and faster for you in the long run.
Thanks for your guide.
Unfortunately, I still can't fully understand so I end up using the script provided by nicandris
forum.xda-developers.com/showthread.php?t=969266
instead of building the module, I build the whole rom.

building a JAR with internal JAR dependencies

Hope you guys can give me some much sought advice.
I've been attempting to build a JAR file that packages it's own JARs as internal class dependencies, but without exposing those inner JAR dependencies to the outside world. I'm guessing this needs to happen, otherwise the link process for building an Eclipse Android project would fail if not.
So my problem is such:
If I have an internal dependency on say dom4j-1.6.1.jar, I don't want to prevent someone from being able to add my JAR to an Eclipse Android project and including their own dom4j package dependency (possibly a different version). If the internal JAR dependency is exposed they will experience a duplicate resource conflict when attempting to build their project.
e.g. java.lang.IllegalArgumentException: already added: Lcom/google/gson/DefaultTypeAdapters$ByteTypeAdapter;
Here is what I tried to date:
So I have a regular Android project in Eclipse which adds in my packaged JAR as an dependency.
I refered to the Oracle docs, however there is a footnote about the inclusion of JAR files within JARs.
Note: The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.
So I decided to try the Fat Jar Eclipse Plug-In from SourceForge.
It's an Eclipse Plug-In for deploying a project into one "fat" executable jar file containing all referenced libraries. References are taken from the project settings, so no manual configuration is necessary.
I did manage to execute my build using this method, however did have to manually hack the packaged JAR file to remove the reference to the annotations package which was causing a conflict with my Android test project by being referenced twice.
So now I am left with a project that builds and executes, but exposes those inner JAR dependency packages to my Android project.
I would appreciate any advice you guys can provide. I hope my explanation is clear enough.

Categories

Resources