Android SDK source code - android

I need to look at the .java files of the android sdk. I have developed applications before but I never needed to look at them so it wasn't a problem then. I saw there is a jar file android.jar that contains all the class files structured but actual sources are not there. git gives various problems to me because I am behind a weird proxy so http://source.android.com/source/using-eclipse.html hasn't been very helpful. What should I do?
EDIT: I'm talking about the java files, just to clarify. And in case you are okay with browsing the code online, Where can I find Android source code online? http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/

Just open the Android SDK Manager and select the Sources for Android SDK of the API level you are trying to support and click Install packages:
(In this case I selected those for SDK v4.3 API-18 and SDK v4.2.2 API-17 but I already have them installed)
If for some reason you SDK manager button doesn't show up on the Eclipse toolbar, follow this recommendations.
To link the source code to Eclipse just follow this instructions; Android Sources are usually under [ANDROID_SDK_FOLDER]/sdk/sources/android-[API_LEVEL]

You can download the ICS sources via the adk manager to your local machine and then attach them to your project in you IDE. See e.g. the blog of Lars Vogel

It is a online latest linux and android source code browsing website.
Android/Linux Source Code Cross Reference
http://hala01.com/

You can browse the .java files of the Android SDK here:
http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android

The links in the other 2 answers, http://hala01.com/ and http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android are no longer working.
You can download and view android SDK source code from this site. As of today in October 2021, source code of up to API level 31 is available.
Since such websites may become unavailable in the future, you may want to download local copies for safe keeping.

Related

add android source code to intellij

how do you add android source code to
intelli j 10
so that i can browse android code in the IDE? yes there is a question and answer here
How to attach android source in IntelliJ 10?
but the answer fell short, the last step is 'navigate to the source on your computer!',
where is the source? where do i download it?
thanks
If you are using some old Android Platform, check this answer.
Otherwise sources should be already downloaded by the SDK Manager and available on your hard drive in the SDK folder, for example:
%ANDROID_SDK%/sources/android-16
This directory can be attached to IntelliJ IDEA Android SDK. I also recommend updating to the latest IDEA version, Android support is much better than in IDEA 10.

the JAR file C:\Program Files (x86)Android\android-sdk\android15\android.jar

has no source attchment. you can attach the source by clicking attach source below.
what should i do. i found different solutions on the web. but it would be nice to find the best solution.
please help out regards
karan
If you use Eclipse , You can find Android Sources Plugin on Adt-addons
In ADT >=8.0.0 you can add Android sources to Android container for all your project with installing the Android source feature using http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/ update site After installing the Android source feature all your existing projects as well as new created projects which is targeted for Android 4.0.1, 2.3.4, 2.3, 2.2, 2.1, 2.0.1, 1.6 and 1.5 will have attached the source jar.
It may not have Android API Level 15 , may be they will update soon

Android Source Code Plug-in

I've been using an eclipse plugin that allows me to view android source code for up to android 2.2. I recently cleared my eclipse folder and copied a fresh instance, thereby loosing the plug-in. I don't seem to remember what the plug-in was called and where I installed it from.
I'm not looking for downloading and building the entire source tree of android. This plug-in would allow me to step into android sources when I wanted.
Does anyone have a link to this plug-in location?
You probably mean adt-addons project. The direct link to plugin you're searching is: http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/
In the properties of your android-ver.jar you can set the location of the sources. I think it is enough to download only frameworks project of the AOSP to attach it as a source of a android.jar library.

Android SDK Examples

My Android emulator contains A list of 'API Demos', including a nice looking password PIN form (with validation) within the App->Device Admin section.
Any idea where the source can be found? Or does anyone know of a good example off a user PIN input sample?
All the examples are included with the Eclipse ADT plugin, I think. Start a new "Android Example" project and you can choose any of the samples.
The samples source and project can be found in your sdk directory. Specifically under ANDROID_SDK/samples/android-XX/ApiDemos (where XX is a certain API level)
If the samples folder is not present, you have to install the samples via the SDK manager first.

Integrating basic android source code into Ecplise

I downloaded the Android SDK and the Eclipse Plugin and installed them. When I however use the "Open Declaration" in Eclipse on basic Android functions and classes such as setOnClickListener or ListActivity it gives me an "Source not found"-Error.
The total Android source code seems to be 2.1 GB. Where do I get the source code of those functions that I call with the API to integrate it into Eclipse?
Check this issue. There is a lot of links explaining how to do it.
The source code is not included with the sdk. If you wish to debug/use android source you need to download it separately from the sdk. It can be found on google's official site here. This site also contains important information about using their source code that you should read.
Was this helpful?
You can see the source code by installing a plugin in Eclipse: http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/

Categories

Resources