How to Attach Android Source to Eclipse

How to attach Android Source to Eclipse

There is an Eclipse plugin called Android Sources that installs the sources up through Gingerbread. I haven't tried it recently.

How to attach Android source to Eclipse?

In Eclipse:

Window > Android SDK Manager, install "Sources for Android SDK" under Android 4.0

When prompted by "No sources attached...", click the button, then choose the Directory "your Android SDK directory/sources/android-API level/"

Example: C:\...\android-sdk-windows\sources\android-16

How to attach source to android.jar

To attach source code for android.jar, you may follow the tutorial at the link below:
http://android.opensourceror.org/2010/01/18/android-source/
Make sure to choose the correct platform version.

If you meet difficutly with spinner, try to get the sample code and see how it works:
http://developer.android.com/resources/samples/get.html

Good luck. :)

Update

This answer is quite out of date, please consider other answers.

How do I attach the Android Support Library source in Eclipse?

After downloading the support package from the Android SDK Manager, you can find the source code of support package in folder <android-sdks>/extras/android/support/v4/src.

Attach Android SDK sources in Eclipse

For newer releases

This is the only way to do it for the newer releases of the SDK:

http://source.android.com/source/downloading.html

It can take a little bit, but once you get it set up, it is easy to repeat for later releases. You will notice too that it helps solve the problem of the autocomplete lagging in Eclipse as well! Well worth it in and of itself...

For older releases

You need to download some source files specific to which Android API version you are working with.

The URL is

https://android.googlesource.com/platform/frameworks/base/+archive/<API version>.tar.gz

And you have to replace with one of these:

  • gingerbread-release for API 9 – Android 2.3
  • froyo-release for API 8 – Android 2.2
  • eclair-release for API 7 – Android 2.1
  • donut-release for API 6 – Android 1.6

so the URL becomes for example:

https://android.googlesource.com/platform/frameworks/base/+archive/froyo-release.tar.gz

for froyo, or:

https://android.googlesource.com/platform/frameworks/base/+archive/gingerbread-release.tar.gz

How to fix the autocomplete lagging problem once and for all

After you have downloaded the file, (which comes as .tar.gz by the way), you have to open the archive, and copy the contents of the base directory, into your

<android-SDK>\platforms\android-<API version>\sources

directory. (Create the sources directory if it does not exist)

When you now start Eclipse, you should have autocompletion working fine again!

Using ADT and SDK manager, attach android source code to eclipse

Open SDK Manager-->install source under api(i.e Android 4.0)

if You got No sources attached then click the button, then choose the Directory

e.g: D:\Android\android___sdk\sources\android-17\ ---> this my android sdk location

Depend upon your android installation directory choose accordingly.

Debugging into Android source

If you're using Eclipse, you can go to Help > Install New Software and paste this link:
http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/

This is a plugin which attaches android source on Eclipse, the other way around is a bit complicated and I haven't tried, but you can do it following the URL below.

  • Here goes the credit
    Source: http://www.mkyong.com/android/attach-android-source-code-to-eclipse-ide/

How to add source of 'Android Private Libraries' to ADT eclipse?

There are many question on that.
Basically the android-support-v4.jar need to be in Referenced Libraries by right click, Build Path.., Add to Path. Then in Referenced Libraries, right click properties on android-support-v4 and set the sources.

Taken from How do I attach the Android Support Library source in Eclipse? and
How to attach source to Google Drive API or `Android Private Library` in Eclipse . Please go through the answers. They'll help you.



Related Topics



Leave a reply



Submit