How to install javadoc for Android Compatibility Package? - android

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.

Related

Android-Studio: Github --credentials get: GitHub: command not found

I was trying to upload my project to GitHub on Android-Studio.
Pushing to GitHub master... process never ends and Version Control Console gives this Error:
GitHub --credentials get: github: command not found
'C:\Users\SA'EED~1\AppData\Local\Temp\git-askpass-2722525787662236837.bat" "Username'
is not recognized as an internal or external command, operable program or batch file.
I only find an empty repository on my GitHub.
Assuming that you have the latest version of GitHub, check your git path.
Settings->version Control -> Path to git-executable
It should be something like -> C:\Program Files (x86)\Git\cmd\git.exe
Note this may vary upon where you have installed GitHub.
Try
Test
It should be a success. Try to push your code again.
If this does not work try solution 2
Solution 2:
Simply make a copy of your project(copy and paste) in some other location. Delete the .git physically from the new copy. Import the new copy into android studio again. Go to version control System(VCS)->Import into Version Control->Share project on github or bitbucket(whichever you have set up). Then enter master password and new repository name. Then your setup is complete and push your code.
You might find the answer you're looking for in this post: http://jrxie.blogspot.de/2014/02/github-credentials-get-github-command.html
tl;dr: you want to add your equivalent of the following folder to your PATH.
C:\Users\YOUR_USER_NAME\AppData\Local\Apps\2.0\LNKHAB6L.QR1\LP7D7JB2.E6Z\gith..tion_317444273a93ac29_0003.0000_c74cce3a838f9354
The folders inside Apps\2.0 are probably named differently, but you shouldn't have any problems finding the right ones.

How to attach source code to Support Library in Eclipse

I read all posts that answer this question but they all are old and didn't work for me.
Is there any way to just attach source code to the Support Library (v4, v7, app_compat..) in Eclipse and avoid seeing the message "This element neither has attached source nor attached Javadoc and hence no Javadoc could be found. note"?
Somebody told me there is no way to do it since it is closed source, is that true? Since there is nothing under the library's source folder.
Thanks.
Here is what solved the problem for me. My project depends on appcompat_v7 library, which (I think) provides the android-support-v4.jar file to the project. I created android-support-v4.jar.properties file exactly as guided in How can I enable javadoc for the Android support library?. Added that file to lib folder in appcompat_v7 rather than project's lib folder.
Try this one:
1) Download jar file containing the JavaDocs.
2) Open the Build Path page of the project (right click, properties, Java build path).
3) Open the Libraries tab.
4) Expand the node of the library in question (JavaFX).
5) Select JavaDoc location and click edit.
6) Enter the location to the file which contains the Javadoc (the one you just downloaded).
Hope this helps.
Source: How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
UPDATE:
If you don't have javadocs itself, you can generate them by yourself:
cd <path_to_android_sdk>/extras/android/compatibility/v4/
mkdir docs
javadoc -d docs -sourcepath src\java -subpackages android.support.v4
Source: How to install javadoc for Android Compatibility Package?

Please install package: 'Android Support Library'

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

Android Eclipse NoClassDefFoundError for external .jar files

I have come across a strange error. I have an Android project that uses external libraries, in particular:
android-support-v4.jar (for Fragment support in Android 1.6)
GoogleAdMobAdsSdk-4.3.1.jar (for ads)
The project ran fine until I updated some aspects of the plugin (can't recall the specifics as I did not pay too much attention to it) and after that, whenever I try to use any class from the above .jar files (or any of its subclasses, even ones defined by me), I would get a java.lang.NoClassDefFoundError. I could not find the answer after much searching, so I am really stumped.
I believe this problem is related to how my IDE is set up and it has little to do with actual code, so I will not post any unless if it's absolutely necessary.
You need to read this - Dealing with dependencies in Android projects.
This link is also useful - ClassDefNotFoundError with ADT 17
Basically, create a folder called libs and place all of your jar files inside. The recent update will automatically take care of the rest for you. You don't need to edit your path anymore.
Android does not support Java1.7 up to now. Jars built with compliance level 1.7 cannot be used in Android Applications. Rebuild your Java project with compliance level 5.0 or 6.0 before exporting the jar file.
I found this post via google and answers above didn't solve my problem. Hope what I say will be helpful to others.
If you see NoClassDefFoundError after upgrading to ADT 22, try this in Eclipse:
Go to Project Properties → Java Build Path → Order and Export tab.
Check the Android Private Libraries option.
Also a warning to others who have updated to r17 with many dependencies. I had a another referenced project on my build path and it still did not work after following ALL the directions on this r17 issue on the internet.
Found out after an hour that my referenced project used an older version of an external Jar than my main project did. When trying to compile the main project, Eclipse would give up due to this jar version difference and I never noticed the warning message in Console.
Solution was to copy the newer version external jar file to the referenced project's libs directory.
Wow - such a productivity killer.....
I ran into this error today too, because of updating to the Android SDK, r17. What the links that #aneal pointed out do not discuss is how to handle external runtime libraries (such as those imported under their own heading - not an imported user library).
The easiest way to solve this problem is to change the build order in the build path. Simply right click on your project and select Properties. From here, select Java Build Path. At the top of the display, choose the tab order and export and move GoogleAdMobAdsSdk-4.3.1.jar above Android X (replacing x with the version you are using). Next, clean your project and run it. You should be good to go!
The way I solved it was by : Right clicking on the project and selecting build path. Select configure build path in the selections that appear. After that see if your libraries are there in the libraries folder and then select the order and export tab and over there select all your jar files. Then select ok and run your project.
If you're using Eclipse with Maven IDE (m2e) go to "Java Build Path" then "Order and Export" and finally check the item "Maven Dependencies" and pull it down to the BOTTOM of the list. You should do the same with project references in the same workspace.
Every time I setup the project in a new computer that happens.

How to attach Android Source to Eclipse

I've previously had success attaching the Android Source to Eclipse by following Finn Johnsen's instructions here.
However this approach seems to have stopped working:
samuel-josephs-computer-4:android-sources samueljoseph$ git checkout origin/froyo-release
Previous HEAD position was 1de4a2c... am 62619392: Merge "Fix leak when keylock is recreated."
HEAD is now at adba66b... This class no longer exists.
There was a more recent blog here which had some pre-organized source for Eclair, but nothing since.
There are also some StackOverflow posts from 2008 (older than both the above), e.g.
https://stackoverflow.com/questions/3182904/attaching-java-source-to-android-projects-in-eclipse.
What is the current guidance for accomplishing this?
There is a updated guide. So, you don't need to install an eclipse plugin for this.
Here is the link
Snip from above Link:
follow below steps if you already have downloaded Android sources
Head into eclipse, and press F3 over some android source you're missing, like Activity. And get this pesky window, which we all hate:
Click Attach Source, choose External Folder, and choose the core/java in the base folder.
There is an Eclipse plugin called Android Sources that installs the sources up through Gingerbread. I haven't tried it recently.
For Android 4+ here's a tutorial for attaching sources to eclipse.
EDIT:
First download the source and javadoc from sdk manager.
Goto Your_Project>>Android XXX, Right-Click on android.jar and select Properties.
Point the sources path as Java Source Attachment>>Location Path by clicking on External Folder
Point the reference path as Javadoc Location>>Javadoc Location Path by clicking on Browse
Now you can browse sources like this:
Here's a tutorial:
Make sure you have installed/downloaded the Android source for the appropriate Android SDK API version.
1.1 Check the API version you have specified in Eclipse for Android/Project Build target:
Open project Properties/Java Build Path and click the "Link Source..." button on the Source tab:
Point to where you have installed the Android SDK, expand the "sources" folder, select the appropriate source API version (and click "OK"):
Next...:
Important step is to exclude the whole linked source from building. Otherwise we could have some duplicate source errors plus who wants to build the whole Android source when we have jars already! So, click "Add...", type in *, click "OK" (and then "Finish"):
Verify everything is configured correctly:
Desired result -- linked platform source w/o side effects:
I hope this helped :)
The best way is as below.
Update Android SDK Manager, including source of the version you need.
click on Any class like activity, if source is properly attached, it will open the Activity class.
If it is not opening up, then click on the attach source and can give source path as above.
Source path will be like android-sdk-windows\sources\android-17
This will help you to add source for android SDK
You can do it this way .... hover or copy paste any class_name which is provided from android , just press F3 you will find a Attach_a_source tag there , click in it & here browse your android-sdk folder
and from it just pick source folder because inside it , every android files resides .

Categories

Resources