# Random compiling questions



## AndroidChakra (Apr 14, 2012)

I an a n00b when it comes to compiling and building Android so I have a lot of random questions. Most I could answer by simply Googling it but others I can't find the answer. My vision, hopefully, is that we can use this thread to ask random, and stupid, questions and get straight answers or links to those answers. Everyone needs to start someplace so I am starting here.

My first error that I ever got, after getting my build environment setup, was a java error.. It looks very similar to this:



> ************************************************************
> You are attempting to build with the incorrect version
> of java.
> 
> ...


I found the solution here: http://ronubo.blogsp...buntu-1204.html

To work around it, you can just comment out the following lines in _build/core/main.mk_:



> # ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
> # java_version :=
> # endif


Then after I got everything to start compiling I got some other random error buried in a bunch of text... Turns out it was a known error that CM made a fix.



> No private recovery resources for TARGET_DEVICE ace
> host Java: guavalib (out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
> Import includes file: out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/import_includes
> host C: libhost <= build/libs/host/CopyFile.c
> ...


Which has the solution here: android_externa_guava
So once you download the file.. what the heck do you do with it??? Took me a minute to dig through the code and Googling but I eventually found it. Take your _maps.java_ file and put it in this location: _external/guava/guava/src/com/google/common/collect/_

I also learned that I can compile certain apps... for example if you do *make Mms* it will spit out the Mms.apk in the out folder.

All of this babbling leads me to my stupid, random, question.... How do I compile JUST the /system/media folder? Is there someplace I can see, and reference, that will tell me how to build random components to a ROM?


----------



## PonsAsinorem (Oct 10, 2011)

AndroidChakra said:


> I also learned that I can compile certain apps... for example if you do *make Mms* it will spit out the Mms.apk in the out folder.
> 
> All of this babbling leads me to my stupid, random, question.... How do I compile JUST the /system/media folder? Is there someplace I can see, and reference, that will tell me how to build random components to a ROM?


I'm not too experienced with pure AOSP (if that's what you're compiling), but I can at least point you to CM10's build/envsetup.sh. Read the first couple of comments.


----------



## AndroidChakra (Apr 14, 2012)

PonsAsinorem said:


> I'm not too experienced with pure AOSP (if that's what you're compiling), but I can at least point you to CM10's build/envsetup.sh. Read the first couple of comments.


I'm bouncing around building different ROMs. I can get everything to work but in order to test what I'm doing I want to build specific folders because I want to see how the output is.


----------



## yarly (Jun 22, 2011)

As mentioned, you do really really really want the Sun Java 6 version and not the Open JDK one. If you are using Debian (stable), it's included if you get it from apt. If you are using *buntu or mint (debian forks), then you can get it from debian and install it.

You would need:

http://packages.debi...e/sun-java6-jre

and http://packages.debi...e/sun-java6-bin

and http://packages.debi...e/sun-java6-jdk

Install each on the command line with dpkg -i <pacakagename> or use whatever gui you use with your desktop.

If you're using red hat based stuff like fedora or whatever, you're semi on your own as I haven't ever compiled Android on it.

For compiling individual parts of android you basically do the following (after running lunch):

mmm packages/apps/Email (for email)

mmm frameworks/base (for like framework crap)

etc etc


----------



## PonsAsinorem (Oct 10, 2011)

AndroidChakra said:


> If you're using red hat based stuff like fedora or whatever, you're semi on your own as I haven't ever compiled Android on it.


Here's a how to on Fedora 17 (the current release of Fedora): Compile AOSP on Fedora 17

And here's for Arch linux (my current and preferred distro): How-To Setup Android Build Environment On Arch Linux 64Bit

I've referenced both guides to set up and compile for CM7-10, and they both work.


----------



## AndroidChakra (Apr 14, 2012)

Thanks for the advice. It has been taken and is appreciated. I have since removed openJDK, uncommented the lines noted above, and replaced with Sun Java and "make clobber" without any errors as well as another run at the one other make command I know "make Mms". Thank you both for saving me potential headaches in the future.



yarly said:


> For compiling individual parts of android you basically do the following (after running lunch):
> 
> mmm packages/apps/Email (for email)
> 
> mmm frameworks/base (for like framework crap)


Sorry - still questions about this. So I could do this:
_mmm frameworks/base/data/sounds_ and it would just output the _/system/media_ folder in my *out* path? Guess not. Just tried it and it said "No Android.mk in frameworks/base/data/sounds." which leads me to believe that I can compile a particular path as long as it has the "Android.mk" file in the last folder?


----------



## yarly (Jun 22, 2011)

AndroidChakra said:


> Sorry - still questions about this. So I could do this:
> _mmm frameworks/base/data/sounds_ and it would just output the _/system/media_ folder in my *out* path? Guess not. Just tried it and it said "No Android.mk in frameworks/base/data/sounds." which leads me to believe that I can compile a particular path as long as it has the "Android.mk" file in the last folder?


Technically yes, but it may not always work. Google now recommends against recompiling sub parts of framework at least. You can try doing it anyways and it might work, but if you run into problems, that's probably the issue.


----------

