Attach Android SDK sources in Eclipse - java

I want to see Android SDK source code in order to understand how it works.
How can I 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!

There is even an Eclipse plugin for that - Android Sources.
However I just downloaded the plugin jar (~200 MB) and extracted sources from it. Then in Eclipse I attached the sources by going to my Android project, selecting android.jar > Properties > Java Source Attachment > External Folder.

In case somebody still needs that crusty old Gingerbread framework code, it can still be found in the depths of the Android source tree:
https://android.googlesource.com/platform/frameworks/base/+archive/gingerbread/core/java.tar.gz

Related

Unity3D: APK file missing

Every time I try and build my game, I am unable to find the APK file anywhere, I did however found the APK file in my recent folder, but it doesn't show up in the respective folders I initially selected or allows me to copy and paste the APK file into my Android device.
I don't even get any errors when the game is built (in fact, I get a message in my console stating that my build was successful) so I am confused to why my APK file is not showing up.
It happened after I recently updated my unity 5.6 to unity 2018.3.1 due to Oracle JDK is no longer free for commercial use and unity 2018.3 uses OpenJDK (I am using AdoptOpenJDK/JDK-12.0.1.12-hotspot). Once unity was installed, I didn't receive any errors only a few warnings within a few scripts (which was only a minor problem and I could solve easily).
However, when I go to player settings, I get this one warning: "failed to get available Android API levels. Make sure your Android SDK tools version is 25 or higher and you have an internet connection."
I made sure that my minimum API level is Android 8.0 'Oreo' (API level 26) and the target API level is Android 8.1 'Oreo' (API level 27), I also uninstall Android studio and reinstalled.
I even went as far as deleting all folders inside build tools and platforms from (appdata>local>android>sdk>buildtools) & (appdata>local>android>sdk>platforms) and updating the files for continuing the build.
However, all the methods I've tried have not to work, so I'm asking for help here. Please, does anyone know why is my APK file not appearing at all? Thank you in advance, I really appreciate it! :)
this solution helped me if Are you using the r22 of android SDK, if so, Google decided to move the aapt.exe from tools directory to build-tools//aapt.exe
A quick solution for this is co copy the aapt.exe file from build-tools and paste as shortcut on tools directory. Keep the shortcut name as aapt.exe
another solution is to download jdk(1.8 version is prefered)from oracle site ["http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html"]and set it instead of the build-in jdk form the project preferences then reboot

Android studio only finding "some" classes when browsing SDK sources

I seem to be having a massive problem with paths when browsing the SDK sources. Basically my issue is this:
I can import (for example) android.annotation.NonNull into my own project and it recognises the class fine. But if I open Activity.java I get random classes not being able to be found - but they exist in the correct path. For example it can find android.os.PersistableBundle (which exists at androidSDK\sources\android-23\android\os\PersistableBundle.java), but not android.annotation.NonNull (which exists at androidSDK\sources\android-23\android\annotation\NonNull.java)
I have tried invalidating caches and restarting, re-installing android studio, installing different versions and even redownloading the whole SDK, but nothing is making it happy. Is there a place I should be setting the 'root' path? How come it finds some classes but not others?
Android 1.2 or idea 14 do not have this problem. After this version have this problem.
You can view thie SDK source by use the Android 1.2. Click here to download. Unfortunately, Android 1.2 version has some other bug.

running an existing project in eclipse setup

I received a full working project's sourcecode for an app written in java.
to set up my win7 machine I followed these steps:
http://www.javacodegeeks.com/2013/03/setup-your-java-development-environment-in-windows-7.html
i opened eclipse and need to work on this project, but have NO idea how to pull in the project with all its files so I can actually run it and test it.
I need to make changes to this project.
the folder is located in MyDocuments folder called Budget
within Budget I have:
.metadata
dev (see screenshot of what is in this folder)
can some one help me setup everything? I have never done this, I am only familiar with XAMPP
i also looked at
How to open an existing project in Eclipse?
i tried it and get files and filders in the navigation pane, how from here?
What you have installed is JavaSE SDK plus a lot of other stuff for regular Java development. But in your screenshot I can see that your project has a Blackberry and Android versions. To develop in these platforms, your Java SDK install is not enough. You'll need to setup both BB and android development environments in your machine. You'll probably need:
For BlackBerry:
Blackberry Java SDK (check which version was the BB subproject made for)
Eclipse with BlackBerry Java plugin. There used to exist eclipse versions with the BB plugin already installed available for download in Blackberry's site. If you don't have one, this is the one you want. And if you already have an eclipse, resist the temptation to just add the BB plugin to it. The BB plugin messes up with almost every other plugin you might already have. Also each plugin was made to a target eclipse version, so just download the bundled eclipse+plugin from BB and be happy:
http://developer.blackberry.com/bbos/java/download/
Also some simulators for your target platform. I think the eclipse plugin comes with one already installed. They are really slow though, so you might want a real device instead.
For android:
Android SDK
An eclipse with the ADT plugin, if the project was made with eclipse, or the newer Android Studio. This eclipse plugin is better made than BB's so you won't need a dedicated eclipse like in BB's case.
Simulators are made with the ADM tool included in the SDK.
Good luck!

Eclipse not creating new Activity and xml layout file (issues started after updating eclipse and sdk)

Today I have update Android SDK tools & eclipse. Current SDK tools 24.0.1, Android development Tools 23.0.4.1468518, eclipse version 4.4.1. After update SDK & eclipse I create new project. In this project src folder is empty & res/layout folder also empty, activity & xml files are not creating. I have to manually create it.
I seen my answers like Link 1, Link 2 etc.
Answer like:- "
Try this
"Help" -> "Install new software" and install (this will update it) from this url: https://dl-ssl.google.com/android/eclipse/"
But I have already update it.But not solve my problem. So, How to create activity & xml automatically?
Latest
As I already said that ADT 23.0.4 and SDK 24.0.1 are not compatible to each other.
We have got another update to of Android SDK to 24.0.2 (May be their team read our this question and released an update so quickly). However this update has not been documented yet on this page but still you will be able to see it in your Eclipse's SDK Manager.
I updated my SDK to 24.0.2 and now it is working fine. You too can try to update your Android SDK to 24.0.2 and hopefully everything will work fine.
Older Answer
The ADT Plugin for Eclipse and Android SDK both should be compatible to each other for making Eclipse do such things automatically.
But it seems like ADT 23.0.4 (Released in October 2014) and SDK Tools, Revision 24.0.1 (Released in December 2014) are not compatible to each other.
We should expect an update to ADT plugin soon which will be compatible with SDK tools 24.0.1.
You can check from the documentation:
For SDK Tools, Revision 23.0.4 (October 2014) they have mentioned the following points.
Android SDK Platform-tools revision 19 or later.
If you are developing in Eclipse with ADT, note that this version of SDK Tools is designed for use with ADT 23.0.4 and later.
If you notice,
But for SDK Tools, Revision 24.0.0 & 24.0.1 (December 2014), They have only mentioned
Android SDK Platform-tools revision 19 or later.
And if you check this document then you will find for SDK 23 or earlier with each revision the compatible ADT version was mentioned but only with 24 they have not mentioned anything yet. So the compatible version is yet to come.
I had same issue but in the end had to undo my update to SDK tool to back to 23.0.4.
If you want to undo your update you can follow the following simple steps:
Download the older ADT plugin manually.
Extract the contents and copy the tools folder from there.
Go to your SDK installation directory and replace the tools folder.
Your SDK will be back to 23 version and everything will start working again.
Try running your Android SDK Manager again, install any available updates for the Tools category and after that select Help > Check for Updates from the Eclipse menu (installing any detected updates here too which should then restart Eclipse).
I was getting the same problem before and it started working again after I have Android SDK Tools version 24.0.2 installed after the above process.
Try this: when creating a new android application use "Empty Activity" instead of "Blank Activity".
This will fix the problem immediately.
Sometimes you have to reinstall eclipse after it crashes. That's why it is a good idea they made it portable. But you can try to go back from the about eclipse uninstall component. But in my experience if you blew the ini and all that maybe the fastest way is to reinstall especially when there are so many dependencies like in adt.
You can also install regular eclipse and android plugin you don't have to use only adt. And maybe eclipse is more stable like that
Another thing you need to recompile the project probably

Android Project with ActionBarSherlock doesn't get built

I implemented the current version of ActionBarSherlock to my Android Project.
Everything works fine and I don't get any errors.
But when I try to debug or export my project I don't get an .apk-file out of my project. Just a .jar-file with the name of my project.
I've read about some problems the SDK had with building projects that contain external libraries but this was at SDK version 14 and so I hope, this bug is fixed...
So there might be another cause for this problem.
Does anybody know a possible solution?
You cannot get *.jar file as the result of building Android project. This seems very strange to me. There must be something wrong with your project settings (if you changed them), or the project you build is of the wrong type (i.e. it is Java Application instead of Android Application).
You didn't mention which IDE do you use, but I assume you use Eclipse.
Make sure you have installed Android SDK and Eclipse ADT correctly (just in case).
Next thing to try is to create a new Android Application project from existing sources (there should be such option during the process of creation).

Categories

Resources