[Q] compiling app from GIT java source - Android Software Development

Hi,
I'm trying to change the Phone.apk application from google GIT java source code. but when i import the application to Eclipse, I'm getting a lot of errors even after loading the correct android.jar file (tried to clean the project) .
1) what is the right way to change application from google source code?
2) How can I know which libraries am i missing?
Thanks a lot,
Idan

I'm not sure if phone will work, i know that other aosp apps work with this method though.
http://iserveandroid.blogspot.com/2010/12/how-to-compile-launcher-calendar-or-any.html

Related

Getting Android source in Eclipse on Windows 7 [solved]

Hi all, I'm just starting getting into App development and I want to attach the Android source code into Eclipse so that I can reference it locally. Is there anyone here who has experience doing this on Windows who is willing to walk me through it?
Alternatively, I'll go it on my own if someone could help me get past this one roadblock. Thus far I've installed Python and msysGit (and updated my PATH variable accordingly) so that I can use git and repo. Something isn't working however and repo runs into an error that I can't seem to figure out. I'm contemplating uninstalling all that and starting from scratch with Cygwin.
Here's a tutorial on setting up Eclipse on windows (albeit over a year old so no guarantees) link
personally I would dual boot linux... it was a breeze setting it up and there's plenty of tutorials for that.
You could install ubuntu (i think) side by side with win7 using wubi, as if it were a program or something. That way you're not messing with partitions.
I already have Eclipse set up. This is not the problem. I'm having trouble downloading the Android source code - NOT the SDK - on my Windows PC. Specifically, I always run into errors when I try to use "repo init -u blah blah" as instructed on the android source page. If someone has successfully done this on Windows, I'd like someone to give me some guidance, because either I'm doing something wrong or my setup is not correct.
Right now I'm trying to use Cygwin (basically creates a linux environment inside Windows). The last time I tried using repo, I got this:
EDIT: Code removed. I found a solution, outlined below, for anyone else who wants to get the Android source into Eclipse.
Okay, I got the source code, it was actually pretty easy to do, and I didn't even need repo to do it . For those who may find this useful, here's how.
0. It is assumed you have already installed both Eclipse and the Android SDK. If you don't have those yet, download them and set those up. If you aren't on Windows but still want to know how to get the source and import it into Eclipse, you can skip step 1.
1. Install Cygwin on your computer. During the installation, you will be presented with a package explorer and you can choose specific packages to install. Choose whatever you like, but make sure to include automake, bison, curl, flex, gcc, git, gnupg, python, zip, and an editor of your choice, like nano or vim (you can use the search field at the top to find these quickly).
This will basically give you a Linux shell on Windows whose root directory is something you've designated, like C:\cygwin.
2. A few more things to set up. Fire up Cygwin and make a bin folder in your home directory. Add this directory to your PATH variable, then cd into it.
Code:
mkdir ~/bin
PATH=~/bin:$PATH
cd bin
This blog post has code for a python script that will be used later. Make a new file using an editor of your choice. Copy the code and save the file as anything you want (I named it "pack.py"). When you're done, cd back to your home directory.
3. Downloading source. From your home directory (or a subdirectory if you wish), use git to clone the platform frameworks base into a new directory (here I've called it "android").
Code:
git clone http://android.git.kernel.org/platform/frameworks/base.git android
cd into that directory and examine the git tags.
Code:
cd android
git tag
You'll get a list of tags. Choose the one that matches the API level you want to build your project(s) in. I'm using API level 10, so I chose android-2.3.3_r1. That's what you're going to check out.
Code:
git checkout android-2.3.3_r1
4. Reorganizing the source code. You need to locate all the java source files and restructure everything into a directory structure that matches the package naming. Fortunately, that script from earlier does exactly this and then zips it up into a nice little package for you called "sources.zip".
Code:
python ~/bin/pack.py
5. Move this zip file to the proper SDK platform folder. Since I downloaded sources for API level 10, I want to move this zip file to
Code:
C:\android-sdk-windows\platforms\android-[B]10[/B]
You can do this with your regular old file explorer on Windows. Extract the contents into a subfolder named "sources".
6. Get Eclipse to recognize them. Open up a project (or start a new one) whose target is the API level you just did all that stuff for. In the package explorer, right-click the project root and click "Refresh". Now when you browse the class files under project-root/android 2.3.3/android.jar/whatever, you'll see actual source code instead of that nasty "Source not found" page.
Enjoy ^_^

Question about compiling from source

When trying to compile Android from source for a particular device, what files are usually pulled from the device to inject into the build? I'm very familiar with compiling applications from source, but compiling a complete system is new territory for me.
myersn024 said:
When trying to compile Android from source for a particular device, what files are usually pulled from the device to inject into the build? I'm very familiar with compiling applications from source, but compiling a complete system is new territory for me.
Click to expand...
Click to collapse
Check the cyanogen source tree at github. If you i.e. check under:
/android/system/device/htc/bravo
you will find a file called: extract-files.sh
In that file is all the proprietary files needed for the build.

github and eclipse

ok ive just set up EGIT with eclipse and i cant seem to get the hang of it. can someone tell me how i would import a package from a git respitory or import an entire git respitory into eclipse, e.g. all of the cyanogen package into eclipse or asop into eclipse?
no one knows of any tutorials or anything to help me out?
http://wiki.cyanogenmod.com/wiki/Loading_source_in_eclipse
Since you have to use repo to sync AOSP and/or CM you won't have any need for EGit. If you want to use Git for your own personal use (for apps you are developing, etc...) I would strongly recommend not using EGit at all because it's a pain in the ass (my own personal VERY biased opinion). Just use git from a terminal/command prompt. Github has nice tutorials on how to do this in linux/OS X/Windows.
I would agree that EGit CAN be a pain in the ass but personally, for my uses which is mainly app development, it's fine. I'll get back to this thread when I get back onto my Ubuntu machine (haven't got eclipse nor Java installed on this computer) and I'll get instructions. If you're not doing ROM or kernel development, EGit is fine and it's quite convenient (having all the buttons for merging, commiting, pushing and pulling in the context menu).
Sorry, I'd forgotten about this but here's how to clone a Git repository just in case you wanted to know.
File->Import->Git->Projects from Git->URI->then put in your remote's URI e.g. [email protected]:myusername/projectname.git->then select the branch you want to clone->change the directory to your workspace directory (my personal preference)->then import the project into eclipse as per usual

Android Studio + GitHub

I'm trying to setup github with my android projects mainly so I can work on them on both my laptop and desktop computers.
I found this video on setting up github and I've created my github account. My issue is when I'm going through the process of Sharing my Project on GitHub I'm not getting the "Add files for initial Commit". It seems like Android Studio is creating the repository and then trying to create the repository again and erroring out for lack of a better explanation.
When I try and push to GitHub I get a can't push because no remotes are defined
Help?
Hi,
I'm using BitBucket, so I have never tested it on GitHub, but I believe it should work as well..
First try download and install some GIT batch/console ( I can recommend this one git-scm.com/downloads[ )
Then enter Git repository local folder ( your project folder ) and now you can arr your remote:
git remote add origin prefix://github.com/user/MyRepo.git ( instead prefix it should be of course https )
Or if remote repository already exist ( git remote -v is listing remotes ) we can change url using this command:
git remote set-url origin prefix://github.com/user/MyRepo.git
I hope it will useful for you.
Best regars
What you need is the knowledge about GIT, not Android Studio.
Using GIT from command line (or even a professional app from Github or Bitbucket) is a lot better than using it in the Android Studio.
Its well-known issue, when you use github gui for git or some in-ide gui's, it could not to work correct(if it will work at all)
better use git bash. also i recommend you to pass 15-min git manual. you'll learn the basics for all your life

Help Please! Android C/C++: Where to find selinux/selinux.h and ctuils, properties.h

edited (solution): I forgot I had another thread on this same basic topic. You have to merge AOSP + Device Sources + Hardware Drives and set it up to build the sources.
https://forum.xda-developers.com/android/software/toolbox-c-struct-define-toolname-tool-s-t3568409
If I try to compile my own customize 'toolbox' binary for example, I can't find the headers anywhere in the toolchains or included headers. I can search them down from Google sources but I gave up after tools.h. I have a feeling this is NOT the way I am supposed to be doing it.
Is there a shared library on my device that I pull off to get these headers? (lib?????.so).. Where do I get headers for Android/log.h and cutils properties.h and selinux.h ??? Or are we not supposed to compile these binaries on a Ubuntu machine? (do I compile them on the device itself?)
ediit: (here's compiling it another way, obviously I can make a hack easily but working with Android is so much harder.)
arm-linux-gnueabi-gcc -static -march=armv8-a toolbox.c -o toolbox
toolbox.c:6:25: fatal error: android/log.h: No such file or directory
compilation terminated.
edit, solved i think
I think it's stand alone toolchain not defined. If that's not the answer, it's a fun answer so I'm playing with that. If I don't have the answer I will pass the question up, download sources and start trying to compile Android proper. (which is my new goal now, I want open source phone and I want to compile my own OS 100%, besides the closed sources, it's so exciting!!) ~so much for sleep

Categories

Resources