Please install package: 'Android Support Library' - android

I am coding a Xamarin application and these are the errors that I am getting when building my application:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5206: Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/appcompat doesn't exist. (XA5206) (SimpleOnePageViewPager)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/appcompat/libs/android-support-v7-appcompat.jar doesn't exist. (XA5207) (SimpleOnePageViewPager)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5206: Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/mediarouter doesn't exist. (XA5206) (SimpleOnePageViewPager)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/mediarouter/libs/android-support-v7-mediarouter.jar doesn't exist. (XA5207) (SimpleOnePageViewPager)
I have added the Android Support Library v4 as a component and in the Android SDK Manager I seem to have everything installed correctly.
Can I please have some help to get my code building successfully?
Thanks in advance
EDIT
I have added the Android Support Library v7 AppCompat as a component and am now getting these two errors:
Error XA5206: Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/mediarouter doesn't exist. (XA5206) (SimpleOnePageViewPager)
Error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\Simon\Documents\Xamarin\SimpleOnePageViewPager\SimpleOnePageViewPager\Components\googleplayservicesgingerbread-16.0.0.1\lib\android\19.1.0\content\support/v7/mediarouter/libs/android-support-v7-mediarouter.jar doesn't exist. (XA5207) (SimpleOnePageViewPager)

in case your "embedded" folder is missing, just downloading and extracting the android_m2repository_r10.zip does not solve the issue.
I deleted the entire C:\Users\\AppData\Local\Xamarin\Android.Support.v4\23.0.1.3 folder and then rebuild as described here:
[Error after updating the Android.Support Library v7 AppCompat to the 21.0.3 version

I solved all of the 'Please install Android Support Library' errors, although I'm not sure which step exactly solved it. However, this is what I did in case someone has the same trouble as I did:
Download "https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip " and paste it in "C:\Users\YourUserName\AppData\Local\Xamarin\Android.Support.v4\21.0.3\". For mac users change the path pre-Xamarin to \Users\YourUserName\ .local\share\Xamarin (Overwrite as needed, but create backup just in case)
Extract the contents of the android_m2repository_r10.zip archive into {...}\Android.Support.v4\21.0.3\content folder (create content folder if it doesn't exist, overwrite as needed and take same precautions as above)
Repeat the steps above but this time for the {...}\Android.Support.v4\22.2.0 folder instead of the 21.0.3
Make sure you have your packages updated to the latest version by right clicking on the Package folder of your solution and clicking Update (At least on Xamarin Studio).
Make sure you also have the latest version of Android Support Library on the Android SDK Manager
In case everything fails, try the AppCompat Android component from Xamarin (your milage may vary with the last one)

I was facing same problem and i followed following link and it is working like a charm.
https://forums.xamarin.com/discussion/56627/xamarin-android-support-v7-cardview-error-depite-being-installed

Just suppress the zip in Xamarin\zips{zip} and rebuild your solution .

In Addition to #sgarcia the answer there are another steps that fixes the problem.
1- Renaming the android_m2repository_rnn.zip file to it's MD5 hash of url.Here is a list of some of them:
android_m2repository_r33.zip --> 5FB756A25962361D17BBE99C3B3FCC44
android_m2repository_r32.zip --> F16A3455987DBAE5783F058F19F7FCDF
android_m2repository_r31.zip --> 99A8907CE2324316E754A95E4C2D786E
android_m2repository_r30.zip --> 05AD180B8BDC7C21D6BCB94DDE7F2C8F
android_m2repository_r29.zip --> 2A3A8A6D6826EF6CC653030E7D695C41
android_m2repository_r28.zip --> 17BE247580748F1EDB72E9F374AA0223
android_m2repository_r27.zip --> C9FD4FCD69D7D12B1D9DF076B7BE4E1C
android_m2repository_r26.zip --> 8157FC1C311BB36420C1D8992AF54A4D
android_m2repository_r25.zip --> 0B3F1796C97C707339FB13AE8507AF50
android_m2repository_r24.zip --> 8E3C9EC713781EDFE1EFBC5974136BEA
android_m2repository_r23.zip --> D5BB66B3640FD9B9C6362C9DB5AB0FE7
android_m2repository_r22.zip --> 96659D653BDE0FAEDB818170891F2BB0
android_m2repository_r21.zip --> CD3223F2EFE068A26682B9E9C4B6FBB5
android_m2repository_r20.zip --> 650E58DF02DB1A832386FA4A2DE46B1A
android_m2repository_r19.zip --> 263B062D6EFAA8AEE39E9460B8A5851A
android_m2repository_r18.zip --> 25947AD38DCB4865ABEB61522FAFDA0E
android_m2repository_r17.zip --> 49054774F44AE5F35A6BA9D3C117EFD8
android_m2repository_r16.zip --> 0595E577D19D31708195A83087881EE6
You can find the list here: https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_m2repository
If the problem still exists the best way is to follow this link's instructions.
Manually Downloading and Installing m2repository Files

user998066, simonbassey and sgarcia.dev - thanks.
Just to update, you don't have to manually download those zip's and extract them in your appdata folder. Just delete them and rebuild your solution. Visual Studio will download and do the rest. It doesn't show that its downloading/extracting/watever in the output window (one thinks its frozen and will kill the VS instance.. dont do it as this is where your download is interrupted and the zip file is corrupt and keeps giving those errors.) and takes a lot of time. If you go to C:\Users\\AppData\Local\Xamarin\zips you will see the zips getting downloaded while you are building your solution. Its a huge file and your first build will certainly take a lot of time until its downloaded..

Ensure the following:
1- Open Android SDK Manager
2- Under Tools Tab --> Find the folder "Extras"
3- Make sure that "Android Support Repository" is installed
Upgrade Xamarin.Android.Support.v4 to 22 or higher. I went on with 25.4.0.2.
Install Xamarin.Android.Support.v7 and everything just works fine.

You have to add android-support-v7-appcompat as library project. It's it sdk android extras.

If you are still facing this problem , try following these steps to resolve it. it did the magic for me
Goto the Xamarin installation folder path . on windows you can find it here C:\Users\simonbassey\AppData\Local\Xamarin
Next delete the zips folder therein (it may have been corrupt or not an updated version of the support library). Also delete every other Xamarin.Android.Support.* folder there.
Head on to the visual studio solutions folder for the project and delete the bin/ and debug/ folders.
Restart visual studio and rebuild your project.
See this thread for more details

What fixes in my case was:
1- Open Android SDK Manager
2- Find the folder "Extras"
3- Make sure that "Android Support Repository" is installed
Then in VS:
1- clear the obj and bin folder
2- clean and rebuild the solution

Following two links helped me with all jdk and droid project related problems. In case it may help other guys also.
Cleaning particular zips
Setting java version

Related

Build unsuccessful : Error with Android project in Xamarin.Forms

I just create a small Xamarin.Forms sample application. When i build my Android project i get some errors.
I just googled errors and find some solutions. But nothing works fine.
Last day i had reinstalled Visual Studio 2015 and Xamarin Studio.
So probably xamarin will be updated in all.
Here I just list my errors and suggested solutions.
Error 1 :
Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the ...~\Local\Xamarin\Android.Support.v4\21.0.3\content directory.
Suggested solution :
The file is downloaded successfully and replaced as per the error message.
Error 2 :
_Please install package: 'Android Support Library' available in SDK installer. Java library file ...~\Local\Xamarin\Android.Support.v4\21.0.3\embedded\classes.jar doesn't exist.
Please install package: 'Android Support Library' available in SDK installer. Java library file ...~\Local\Xamarin\Android.Support.v4\21.0.3\embedded\libs/internal_impl-21.0.3.jar doesn't exist._
Suggested solution :
Android Support Library is deleted and reinstalled.
Error 3 :
Reason: ...~\Local\Xamarin\zips\1FD832DCC1792D8ACA07FAC3259FC5A9.zip is not a valid zip file.
Suggested solution :
I didn't find any solutions for this error.
These solutions are still useless. and not working in my case.
I'm using :
Xamarin 4.0.0.1689 (f860fe4)
Xamarin.Android 6.0.0.34 (3efa14c)
Xamarin.iOS 9.2.1.51 (3c0ec35)
Here is the detailed report :
=== Xamarin Studio ===
Version 5.10 (build 871)
Installation UUID: c5309e12-1ab1-494c-9296-033a0a5c3f24
Runtime:
Microsoft .NET 4.0.30319.42000
GTK+ 2.24.23 (MS-Windows theme)
GTK# 2.12.30
=== Xamarin.Android ===
Version: 6.0.0
Android SDK: D:\Android\android-sdk
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 24.4
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_55
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)
=== Xamarin Android Player ===
Version: 0.6.5
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe
=== Build Information ===
Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 07:16:34-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-windows-cycle6
=== Operating System ===
Windows 6.3.9600.0 (64-bit)
Any ideas or suggestions to come out of this errors ?
EDIT: This information is now included in our documentation: https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/
Xamarin.Android Support Library NuGet m2repository fixes
1. Investigation
You may run into issues with downloading the m2repository when referencing a NuGet package of the Android Support Libraries / Google Play Services.
Example error:
Download failed. Please download
https://dl-ssl.google.com/android/repository/android_m2repository_r25.zip
and put it to the
C:\Users\[Username]\AppData\Local\Xamarin\{SUPPORT LIBRARY NAME}\{VERSION NUMBER}
directory."
Mac Directory: /Users/[Username]/.local/share/Xamarin/
Windows Directory: C:\Users\[Username]\AppData\Local\Xamarin\
2. Folder Contents
This example will be using Windows paths. This can be applied to either OS.
Given the following: C:\Users\[Username]\AppData\Local\Xamarin\
A folder for each of the respective Android Support Libraries / Google Play Services will be shown.
Each library should have a collection of versions:
Note: In this example I'm showing all of the versions of Android.Support.v4
We will then investigate the respective version we're interested in. We should see two folders inside, content and embedded:
content - Contains the m2repository
embedded - Contains the respective .aar contents
3. Automatic Fix
Delete the versioned library folder that is giving you errors:
Mac Directory: /Users/[Username]/.local/share/Xamarin/{SUPPORT LIBRARY NAME}/{VERSION NUMBER}
Windows Directory: C:\Users\[Username]\AppData\Local\Xamarin\{SUPPORT LIBRARY NAME}\{VERSION NUMBER}
Rebuild your project (Which will kickoff a Build Task to re-download the library).
4. Manual Fix
There are two steps to manually fixing this error.
Adding the m2repository folder to the /content folder.
Adding the respective Android Support Library / Google Play Services .aar contents to the /embedded folder.
1. Adding the m2repository to the /content folder
Download the respective m2repository from google.
https://dl-ssl.google.com/android/repository/android_m2repository_r25.zip
Note: This version number will vary based on your error message.
Extract that .zip to any directory. There should now be a android_m2repository_r25 folder.
Inside the android_m2repository_r25 folder, we have a m2repository folder.
Place the m2repository into the {VERSION NUMBER}/content folder
2. Adding the .aar contents to the /embedded folder
Inside the m2repository folder, there is an .aar for the support library to be resolved. It can be found in the com\android\support directory:
Example:
m2repository\com\android\support
There should be a support-v4\{VERSION NUMBER} which will contain the .aar file.
Extract the .aar and put the contents into the embedded folder.
Example:
m2repository\com\android\support\support-v4\23.1.1\support-v4-23.1.1 will contain items such as a aapt, aidl, assets, libs, res, AndroidManifest.xml, annotations.zip, and classes.jar.
Place all of the contents into the {VERSION NUMBER}/embedded folder.
5. New Manual Fix
Get the URL of the missing m2repository download
Use a MD5 hash on the download URL
Rename the file to {MD5HASH}.zip (Where MD5HASH is the hashed download URL)
Place the new hashed .zip file in your Xamarin\zips directory
Delete all the zip files. Even if it asks you to download and replace, it will corrupt again. The quicker way is to just delete all the zip files and rebuild, it will automatically download and unzip as required.
The Android m2repository gets corrupted often on my machine.
With Android I also suggest, build against API 23 (6.0) and set you minimum level to 15 (unless you really need API 10). Make sure you don't use the "Latest SDK" selection, that has been known to cause issues in the past as well, select the highest API beneath that.
Delete the zip at \Local\Xamarin\zips\1FD832DCC1792D8ACA07FAC3259FC5A9.zip
Clean and Rebuild your solution.
I get that problem when tried to use xamarin forms 2.0
The problem usually comes when IDE (VS2015 for example) try to decompress that zip... VS hangs and you must force close it ... when you reopen the IDE you cannot compile anything with xamarin that use this version.
First of all you should download r23 no r10. Each one contains assemblies for each version api.
When you have it you should delete library folder on C:\Users\%username%\AppData\Local\Xamarin for example Android.Support.v4
Create a path with the library name C:\Users\%username%\AppData\Local\Xamarin{LibraryName}\23.0.1
Copy and unzip download r23 to C:\Users\%username%\AppData\Local\Xamarin\Android.Support.v4\22.2.10\content
Go to m2repository\com\android\support and under libraryname\version you will get a file with extension ".aar" this is a zip file rename to .rar and unzip it to C:\Users\%username%\AppData\Local\Xamarin{LibraryName}\23.0.1\embedded
By the way a copy of downloaded r23.zip must be leaved on:
C:\Users\%username%\AppData\Local\Xamarin{library name}\23.0.1\
When you have done this you are able to compile again
Spent a whole night struggling to get this working, turned out i had forcefully shut down VS during an initial build thinking it got stuck not knowing it was actually downloading a > 200MB file to my C:\Users[UserName]\AppData\Local\Xamarin\zips folder.
Deleting the corrupt zip file and being patient enough to rerun a rebuild definitely fixed the issue.
In Simple Words
-> After handling and clearing all the Errors in your Xml documents
-> click on the hammer icon to build and make project Or Press Ctrl+F9

Build path error when creating android project in Eclipse

When creating a new android application i get the following error messages.
Project 'appcompat_v7' is missing required source folder: 'gen' appcompat_v7 Build path Build Path Problem
The container 'Android Dependencies' references non existing library '/Users/Edvin/Documents/Edvins Workspace/appcompat_v7/bin/appcompat_v7.jar' MyFirstAndroidApp. Build path Build Path Problem
Im using Android 5.1.1 (API 22) and I've also installed other SDK packages that were required. When i create the project I compile and target with API 22 and the rest of the setting i leave as default. I've seen somewhat similar questions regarding this but the solutions have unfortunately not worked out for me.
Any help or thoughts is greatly appreciated!
If you can then install Android Studio which is the officially supported IDE for android sdk.
You won't have to download libraries jar and instead use the repositories in the maven servers.
Alternative :::
In project.properties file remove appcompat_v7 reference line. Then remove all the error lines that you get in some files like manifest.xml, values folder files, and may be in some java files.
Since appcompat_v7 is not there then its all references should be deleted.
In activity files extend it to Activity.

Error after updating the Android.Support Library v7 AppCompat to the 21.0.3 version

after updating the Android.Support Library v7 AppCompat to the 21.0.3 version I've got this errors:
1>C:\Program Files (x86)\MSBuild\Xamarin\Androi\Xamarin.Android.Common.targets(236,2): error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users...\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\classes.jar doesn't exist.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(236,2): error XA5207: Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users...\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\libs/internal_impl-21.0.3.jar doesn't exist.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(236,2): error XA5206: Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users...\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded./ doesn't exist.
I tried deleting the Android Support Library 21.0.3 from the SDK manager and download it again.
There is similar question: Android Support Library and Media Router .jar files cannot be found however I am not using map in my project. How do I fix this?
I'm using Visual Studio 2013,
Compile using API 21 (Xamarin.Android v5.0 Support),
Minimum terget API 16,
Terget API 21
Delete folder: 21.0.3 (...\AppData\Local\Xamarin\Android.Support.v4\21.0.3)
Rebuild your application.
Works fine to me:
Delete folders (...\AppData\Local\Xamarin\Android.*)
Remove *.zip files from (...\AppData\Local\Xamarin\zips)
Rebuild your application.
You can try one of these three options:
1- First is to let VS solves the problem it self. It can be done just by deleting (...\AppData\Local\Xamarin\Android.Support.v4) directory (as rubStackOverflow said) and then rebuild the project. VS will download and install what it needs. If it does't work do number 2.
2- Manually Downloading android_m2repository_rnn.zip and putting it into (...\AppData\Local\Xamarin\zips ) folder. VS will do the rest (including extracting and installing the file). You can download m2repositories from here:
https://dl-ssl.google.com/android/repository/android_m2repository_r33.zip
Just rename the number at the end of URL to what you need and then download the file.
Note: In some cases you might need to rename the file into it's MD5 hash of URL. (for me VS was a little stupid and doesn't do anything unless I renamed the m2repository file to it's MD5 hash).
Here is a list of some of MD5 hashes:
android_m2repository_r33.zip --> 5FB756A25962361D17BBE99C3B3FCC44.zip
android_m2repository_r32.zip --> F16A3455987DBAE5783F058F19F7FCDF.zip
android_m2repository_r31.zip --> 99A8907CE2324316E754A95E4C2D786E.zip
android_m2repository_r30.zip --> 05AD180B8BDC7C21D6BCB94DDE7F2C8F.zip
android_m2repository_r29.zip --> 2A3A8A6D6826EF6CC653030E7D695C41.zip
android_m2repository_r28.zip --> 17BE247580748F1EDB72E9F374AA0223.zip
android_m2repository_r27.zip --> C9FD4FCD69D7D12B1D9DF076B7BE4E1C.zip
android_m2repository_r26.zip --> 8157FC1C311BB36420C1D8992AF54A4D.zip
android_m2repository_r25.zip --> 0B3F1796C97C707339FB13AE8507AF50.zip
android_m2repository_r24.zip --> 8E3C9EC713781EDFE1EFBC5974136BEA.zip
android_m2repository_r23.zip --> D5BB66B3640FD9B9C6362C9DB5AB0FE7.zip
android_m2repository_r22.zip --> 96659D653BDE0FAEDB818170891F2BB0.zip
android_m2repository_r21.zip --> CD3223F2EFE068A26682B9E9C4B6FBB5.zip
android_m2repository_r20.zip --> 650E58DF02DB1A832386FA4A2DE46B1A.zip
android_m2repository_r19.zip --> 263B062D6EFAA8AEE39E9460B8A5851A.zip
android_m2repository_r18.zip --> 25947AD38DCB4865ABEB61522FAFDA0E.zip
android_m2repository_r17.zip --> 49054774F44AE5F35A6BA9D3C117EFD8.zip
android_m2repository_r16.zip --> 0595E577D19D31708195A83087881EE6.zip
You can also find the list here: https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_m2repository
3- Manually Downloading and Installing m2repository Files. The detailed process can be found here:
https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_and_Installing_m2repository_Files
Close Visual Studio
Delete or rename Xamarin folder in C:\Users\\AppData\Local\
Open the visual studio project again
Clean the solution
Rebuild it and wait for long time don't interupt.
Deleting all my cached nuget packages and rebuilding the solution fixed the issue for me. I deleted the folders from within here:
C:\Users\{YourUserName}\.nuget\packages

No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'

I have added android-support-v7-appcompat and appcompat_v7 to the project explorer. And also added the android-support-v7-appcompat.jar to the build path.
But again I'm getting this
No resource found - Theme.AppCompat.Light.DarkActionBar!
How to fix this?
For me the solution involved recreating Android's v7 application compatibility (appcompat) support library:
Create the new android-support-v7-appcompat library according to the instructions on the Android developer Support Library Setup page. Note: I had to manually change the project.properties file to get the new library to compile. Change target=android-19 to target=android-21.
Explicitly add this new android-support-v7-appcompat library to your troubled project:
After that's done the project's properties should look something like this:
Now, the project should compile. It's a long way to go, but it worked for me.
An interesting side effect of all of this work is that when I created my next project, Eclipse automatically created a new appcompat_v7 library project, added it to my workspace, and suddenly everything was back to normal. I probably did something different, but I just haven't been able to figure it out what yet. Anyway, I finally got my project to compile and in the process it appears that I reset something in the Eclipse ADT.
I hope this helps.
please check whether the version of android you are targeting , do you have the SDK build tools and latest support package ??
If not please go to
Window>Android sdk manager>
Click the packages for targeting the exact version and update the support if you are targeting the latest
If none of the above worked then u may have deleted the older sdk build tools in sdk manager after update.Please re-install them and restart eclipse , everything works fine .

How to install javadoc for Android Compatibility Package?

How to generate custom javadoc for android 1.4 compatibility package?
The reference docs are available online (example), but is there some place where I can get a zip with javadoc available offline?
I suppose using the javadoc would be pretty simple, just a matter of setting the javadoc location for the compatibility jar.
You can generate your javadoc offline on your own from the source code. Just navigate to your android sdk directory then do the following
cd <path_to_android_sdk>/extras/android/compatibility/v4/
mkdir docs
For Windows:
javadoc -d docs -sourcepath src\java -subpackages android.support.v4
For Linux/Mac:
javadoc -d docs -sourcepath src/java -subpackages android.support.v4
This will generate your javadocs for you locally in the docs directory that you just created.
Then in your eclipse android project, go to your project properties where you added the your android-support-v4.jar, edit it's properties and add the the path to the javadocs you just created.
That should work!
ADT 17+ issues:
As some of you have pointed out. There have been issues getting Eclipse to see the attached javadoc for ADT 17+. This is a known issue and a bug has been filed. This is not related to the way you generate the javadoc (as I described above), rather this is an issue with ADT 17+ integrating with Eclipse. Someone has described a workaround and it can be followed here:
http://code.google.com/p/android/issues/detail?id=28801
Problem: If the android-support-v4.jar is in the /libs folder (as the ADT 17+ require) the javadoc is unavailable.
Edit: I have workarounded the problem by linking the offline version of the android javadoc to the android-support-v4.jar. As far as I know it is still not possible to link the online version (http://developer.android.com/reference). Steps:
Download the Documentation for Android SDK from the SDK Manager. You can find it under the latest Android version (4.1)
Link the javadoc folder to your project's folder, in Windows open a console and type: MKLINK /J {PROJECT_PATH}\android_docs {SDK_PATH}\docs\reference
Create the file libs/android-support-v4.jar.properties with this content:
src=android-support-v4.jar
doc=../android_docs
Close the project and reopen it. Clean if necessary.
The javadoc is linked. Check it by going to any Support library class, like android.support.v4.app.FragmentActivity
Thanks to this answer https://stackoverflow.com/a/11579339/933261
The answer by #wnafee is spot on, but if you are using Linux don't forget to use the forward slash character at this location like src/java.
IF YOU'RE ON WINDOWS and get stuck for ages like me, make sure you escape your backsmashes in the properties file, or things will silently fail. (who makes silent failing loaders anyway...)
This this is my properties file:
src=android-support-v4.jar
doc=doc\\android-support-v4_doc
and my dir looks like this:
android-support-v4.docs.zip
android-support-v4.jar
android-support-v4.jar.properties
doc
close project and open, and it all works for me.
I generated this one based on wnafee's answer:
https://dl.dropboxusercontent.com/u/31272696/android-support-v4.zip
I went through all of these solutions and none of them worked. Here is what I did to get it to work:
Navigate to the following folder:
D:\\Android-SDK\android-sdk-windows\extras\android\support\v4
Run the command:
javadoc -d docs -sourcepath src\java -subpackages android.support.v4
In your project's libs directory, create a file called android-support-v4.jar.properties
In the properties file, add the following lines (change the path to match yours):
doc=D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4\docs
src=D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4\src
In Eclipse, bring up the properties dialog for the Build, then navigate to Java Build Path and select the Libraries tab.
Expand the support library. In my case the path is:
D:\Program Files\Android-SDK\android-sdk-windows\extras\android\support\v4
Select Javadoc location. Click on the Edit button and then select the path to the docs. In my case it was:
file:/D:/Program Files/Android-SDK/android-sdk-windows/extras/android/support/v4/docs/
Close everything, including Eclipse and restart. You should now be able to browse docs in your code.

Categories

Resources