19

I added to my project support library android-support-v7-appcompat, but I can't add source and javadoc for it.

I downloaded https://android.googlesource.com/platform/frameworks/support/+/master package with source and in Eclipse I set Source attachment to v7/appcompat/, but it doesn't work.

Can someone help me?

E: my solution is, I have two projects in Eclipse "android-support-v7-appcompat" (original lib from android-sdk\extras\android\support\v7\appcompat) and "android-support-v7-appcompat-src" (src from android.googlesource.com) and when I compile release version, so I used original lib and for debug I used src from googlesource.com.

PS: sorry for my english

Jozka Jozin
  • 2,350
  • 1
  • 16
  • 12

3 Answers3

9

I was able to attach the source based on advice from How do I attach the Android Support Library source in Eclipse?.

Here's what I did:

First, clone the source repository and get whatever version corresponds to the released library (which I guessed):

  1. git clone https://android.googlesource.com/platform/frameworks/support
  2. cd support
  3. git checkout android-4.3.1_r1

Next, in Eclipse:

  1. Right-click project and choose Properties.
  2. Select Java Build Path
  3. Select the Libraries tab
  4. Add External JARs > YourProject/libs/android-support-v7-appcompat.jar (I know your project had already referenced to it but don't worry, just add it again).
  5. Expand jar and attach Source to the External Jar: WhereverYouHaveTheSource/support/appcompat
  6. Switch to the "Order and Export" tab, move the external jar above the "Android Dependencies"
Community
  • 1
  • 1
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
8

Or the same using @andr answer to How do I attach the Android Support Library source in Eclipse?

git clone https://github.com/android/platform_frameworks_support android_sources_folder

add android-support-v7-appcompat.jar.properties file into libs (next to android-support-v7-appcompat.jar) with content

src=D:\\android_sources_folder\\platform_frameworks_support\\v7\\appcompat\\src

close and reopen project

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
  • 4
    I was unable to make the solution by Johnson work so I turned to your answer and it works great. Thanks. For everyone else, I just added "android-support-v7-appcompat.jar.properties" in my app_compat project. It contains the values: `doc=/home/sufian/Apps/eclipse/android-sdk-linux/docs/reference/ src=/home/sufian/Android Open Source/support/v7/appcompat/src/`. – Sufian Sep 08 '14 at 19:38
  • Also note, guys, if multiple libraries have **android-support-v4.jar** file then you need to have **android-support-v4.jar.properties** against each. I needed this to have my Javadocs and Sources work once again. – Sufian Nov 14 '14 at 14:16
6

Sources for appcompat-v7 are available within "API21/Sources for Android SDK" package which can be downloaded with SDK Manager, the path is \sdk\sources\android-21\android\support\v7\

Android Studio will allow you to browse lib source code when you point this dir as appcompat-v7 source dir root.

tomash
  • 12,742
  • 15
  • 64
  • 81