While trying to debug a program I wrote in Eclipse for Android, I receive an error saying there's no source attachment for android.jar.
How do I get that source attached to Eclipse to continue my debugging?
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
If you really want to have the android.jar sources, follow these easy steps: (for Eclipse IDE)
Install plugin Android Source by going to Help->Install New Software-> add this site: "http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/". Select Android Sources from the list, click Next, and install like usual. Restart Eclipse when prompted.
If sources are still not attached, attach them manually. You will find the sources in the plugin folder usually ECLIPSE_PATH\plugins\com.android.ide.eclipse.source_MAY_BE_VARY\VERSION
Depending of the version of Android, they'll be in the different folders. (eg: for Android 4.4 the sources are in folder named 14). Sources will be in source.zip archive.
In Eclipse package explorer:
Right click on android.jar then Maven->Donwload Sources.
Wait a bit until the process is finished and you're done. (I am not sure if checking "Install Sources" in Android SDK Manager is a prerequisite for this, but you can try and tell us)
Related
I have installed Android Studio for the millionth time but when i go to C:\Program Files\Android\Android Studio , i can't find any folder named "SDK" , can't find it any where on the computer either.
Also, the SDK manager doesn't open, which i guess is a problem linked to the first one.
If you have downloaded the AS + SDK bundle:
Assuming the defaults were left unchanged, you will find the SDK in
C:\Users\%USERNAME%\AppData\Local\Android
If it is missing at this location, one of the following reasons apply: you have chosen a custom location, you missed to install the SDK at all, or (unlikely) they have changed the default install location.
Note #1: the AppData directory is hidden by default. If you have a standard Windows configuration, the C:\ path above should work "as is" (hit Win + R -> paste the path -> Enter).
Note #2: you will never find the SDK in the Android Studio directory unless you have explicitly put it in there. The reason is that those directories might be deleted after installing a newer version of Android Studio and you would have to re-install the SDK as well.
If you have retrieved the standalone SDK by some other means:
The SDK location may vary (from my experience), however (assuming the default configuration) you will most likely find it in C:\Program Files\Android or C:\Users\%USERNAME%
Tools > Android > SDK Manager > there you'll see the path to SDK
If you don't have it at C:\Users\%USERNAME%\AppData\Local\Android (this is where most people have it) than it is possible you don't have it installed. Go to Tools > Android > SDK Manager and then click on "Android SDK." On the top of the SDK Manager it will list the SDK Location. Click edit. If you don't have Android SDK installed, it will give you the option to install it in certain location. Install it, and Android Studio should work!
SDK folder by defalut is in C:\Users\<user-name>\AppData\Local\Android. And the AppData folder is hidden in windows. Enable show hidden files in folder option, and give a look inside that.
Make sure all the folders are visible.
click start>control panel>Appearance and Personalization>Show hidden files and folders then click "Show hidden files, folders and drives"
The file should be in C:\Users\Username\AppData\Local\Android as mentioned above. otherwise you can check by opening Android SDK Manager - top left under SDK path.
If SDK folder is present in system, one can find in C:\Users\%USERNAME%\AppData\Local\Android
If Android/SDK folder is not found
Once done with downloading and installing Android Studio, you need to launch studio.
On launching Android studio for the first time, we get option to download further more components, in that we have SDK.
On downloading components one can find SDK under Appdata (C:\Users\%USERNAME%\AppData\Local\Android)
I had to open Android studio and go through the wizard. Android studio will install the SDK for you.
If your are using android studio go to file >> project structure on the left pane press on SDK location . you will find the path where your sdk is located
When you install the android studio just by downloading from https://developer.android.com/studio/install.html sometimes sdk folder will not get appear in C:\Users\home\AppData\Local\Android Location..
But to set the android studio we need to set the path for android on this location.
So simply
1) start the android setup.
2) follow the instruction and android studio will automatically download the sdk folder by itself. (it will show the window like "Downloading Components").
After completing that installation check the above path again.
sdk folder will get appear now.
I faced the same issue. And I am able to resolve it by uninstalling the previous version I had, and removing the Android studio projects and reinstalling it.
And then go to Settings-> Android Studio -> Click on edit, to specify studio location, it will recognize the requask you if you would like to download sdk,
So I was trying to root one of my old phones and process required Android SDK. When I searched Android SDK, all i could do was download and install Android Studio. Everything went fine and smooth, till I tried to look for SDK in installation. I could not find it under Android Studio installation. But after a little search on Google and Android Studio configuration on my computer, I was able to find it at
C:\Users\username\Android\sdk
I hope that helps.
C:\Users\*********\AppData\Local\Android\Sdk
Check whether the USERNAME is correct, for me a new USERNAME got created with my proxy extension.
I found it in /Users//Library/Android/sdk
For me it was :
C:\Users\{your-user-name}\AppData\Local\Android\Sdk\tools\bin
Hope it helps!
After installation if you get a message about Proxy, it means that you're probably behind a firewall. You can create a new Outgoing firewall rule to include it. Add this to Allow:
C:\Program Files\Android\Android Studio\bin\studio64.exe
It will then download required SDK components
Once that's done, SDK will be in:
C:\Users\your_user_name\AppData\Local\Android\Sdk
For anyone who really can't find the SDK, you can manually download it from android studio.
File => Settings => Appearance & Behavior => System Settings => Android SDK
If you do not have a SDK (or did not select the right folder), you will be asked to select the SDK version and the folder where the SDK will be installed.
This is how I fixed by SDK not found problem.
System: Ubuntu 16.04 LTS, yet you can try these steps in accordance to your respective systems.
If there is an SDK file present, it should be most likely found at /home/USERNAME/Android/sdk
USERNAME is to be replaced by your username
If there is none, check the specified sdk path for the project in android studio.
File > Project Structure > sdk path
The sdk directory should be present in the specified path. In case, it is not there, open the file:
PROJECT_DIRECTORY/android/local.properties
PROJECT_DIRECTORY needs to be replaced by your project name.
If the file is not there, create it.
Then add the following line depending on where you find the sdk directory.
If sdk is there at /home/USERNAME/Android/:
add the line: sdk.dir = /home/tanya/Android/sdk
If sdk is not there at /home/USERNAME/Android/:
add the line: sdk.dir = /home/tanya/Android/
If the path specified for sdk directory in 'Project Structure' is entirely different and the sdk directory is present at the specified location,
add the line: sdk.dir = SPECIFIED_SDK_PATH
Add the specified sdk path in place of SPECIFIED_SDK_PATH
I'm trying to attach the android source code to my gradle project using Android Studio. The problem is that the SDK tab does not appear if you are using a gradle project and I can not attach the source code. I tried with version 0.4.3 and does not work.
Any idea or work arround?
EDIT: I've attach a capture with my project structure without sdk option.
Thank you,
The short explanation is that Android Studio has added some functionality to try to automatically manage IntelliJ SDKs; if you give it a JDK path and Android SDK path in Project Structure > Android SDK, it will automatically create a Java SDK and Android SDKs for each API level you have installed in your Android SDK. The problem is, if it creates an Android SDK for an API level that doesn't have the sources downloaded, if you go into SDK Manager later and download the source, it doesn't pick that up and update its SDK. I've filed https://code.google.com/p/android/issues/detail?id=65230 for this. In that bug I list two workarounds, which I'll explain here:
You can actually get at the SDKs panel you're looking for. We hide it if you have a Gradle-based project open since we want Gradle-based project users to not have to worry about it, but since we also support IntelliJ-style projects that use its internal builder, it's still possible to access it so those users will be able to make their projects work. You can get at this panel if you access Project Structure without a project open. To do so:
Close all open projects
From the Welcome to Android Studio screen, go to Configure > Project Defaults > Project Structure > SDKs
Choose the appropriate Android API SDK that you installed source for, and go to Sourcepath panel
Press the + button, and choose the source directory.
If you're having trouble following that, let me know and I can post screenshots.
Another approach would be to blow away all of Android Studio's auto-created SDKs and let it rebuild them. To do that
Exit Android Studio
Delete the jdk.table.xml file, which on MacOS will be in your home directory under Library/Preferences/AndroidStudioPreview
Relaunch Android Studio
Go into Project Structure (either from the Welcome screen or from a project), and choose the Android SDK tab
Make sure the Android SDK location and JDK location are correct.
Check the compileSdkVersion in your build.gradle file and download the "Source for Android SDK" for respective API from Android SDK Manager.
SDK manager icon will be available on Android Studio tool bar.
Nothing else needs to be done.
Note : Source Code for Android SDK is only available for and after API 13 .
I just initialised a project on Android Studio, and it was working fine in version 0.2.6, but in 0.2.7, I get this error:
It creates a folder inside my Applications directory, but it does not initialize the project. Any help regarding this problem would be appreciated. I get no problems with version 0.1.1 through version 0.2.6, but when it comes to 0.2.7, things start to get problematic, like this and I can't even start a project.
With 2.7 update I got the same issue. It looks like now Android Studio thinks sdk lays in under its own folder at android-studio/sdk.
You should be able to use android app under android-studio/sdk/tools to get missing components (not tested).
Another solution would be to fix sdk path (tested):
Close any projects then drop to Welcome to Android Studio Dialog
Select Configure -> Project Defaults -> Project Structure
Select SDKs -> Android SDK -> Android SDK Home Path
Update it to your previous sdk location.
got the same problem when applying the last patch (2.7). I've resolved it by copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\ then I've launched it and install the missing component.
After restarting Android Studio it works again !
You must manually run SDK Manager.
Folder: android-studio/sdk/tools
Search for android or android-sdk
The new Support Repository must be already selected, and you need only click the "Install" button.
Just as Leonidos said, install ASR through SDK Manager:
Tools > Android > SDK Manager ; Navigate to the Extras folder, and select Android Support Repositories.
Click install packages and it will work fine
I did a fresh install of Java, SDK and Android Studio, update it to 0.2.7 and install the ASR through SDK Manager, but the messages comes again.
So i found this solution.
The most common problem for Android Studio and 64Bit Windows System is the no 8.3 short path for
C:\Program Files and C:\Program Files (x86).
find_java.exe
couldn't handle it and give a wrong path back.
Finally do this:
dir /x C:
-- It shows no 8.3 short paths.
fsutil 8dot3name query C:
-- It shows NtfsDisable8dot3NameCreation is 1 on "C:",
means 8.3 short path won't be created in "C:".
Then I enable the generation of 8.3 short name by:
fsutil 8dot3name set C: 0
and create short names for C:\Program Files and C:\Program Files (x86) in windows recovery mode by:
fsutil file setshortname "C:\Program Files" PROGRA~1
fsutil file setshortname "C:\Program Files (x86)" PROGRA~2
And now dir /x C: can show the short names.
And now find_java.exe -s
can show the short path C:\PROGRA~1\Java\JDK17~1.0_2\bin\java.exe.
And now find_java.bat and android.bat can work good now!
source
Also copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\
Just a few ideas to try that should hopefully help. These can be found by using Ctrl + Shift + A.
"Sync project with Gradle" - (it's also often in the toolbar with a green and yellow ball and a blue down arrow next to three android icons)
"Gradle" and select the ToolBox option; then hit the blue refresh icon to refresh all the gradle projects
"Project Structure..." (also available under File) Under the Libraries project settings you should see a valid reference to your support library. You'll also want to skim through everything to make sure everything else looks good with the project.
"Invalidate Caches..." (another available under File) Invalidate and restart. This one got me going again after the previous upgrade generated a bunch of errors.
Some of these may be redundant, but after having fought with similar issues in the past it's just a few easy things I've found to check.
If refreshing everything doesn't work you can always pull up the Android SDK from Tools -> Android -> SDK or from the toolbar with the blue/green boxy android that has a black down arrow. It should be next to the Sync Gradle button.
I update the Android Studio(AS) and see the same issue.
However, there is something slightly different about what I find out.
I actually have two sdks because I shift from Eclipse to AS.
Hence, I get one sdk in
c:\Program Files(x86)\Android\android-sdk
and anther in
c:\Android\android-studio\sdk.
And the real one that I use is in c:\Program Files(x86)\Android\android-sdk.
The important thing is that, I find that only one of the sdk setting is changed after the update.
Quick Start > Configure > Project Defaults > Project Structure
> Platform Settings > SDKs
1.7
JDK home path:
C:\Program Files\Java\jdk1.7.0_10
Android 2.2 Platform
Android SDK home path:
C:\Program Files(x86)\Android\android-sdk
Android 4.0.3 Platform
same as 2.2
Android 4.2.2 Platform
Android SDK home path:
C:\Android\android-studio\sdk <- it is modified after update!!!!
Android 4.3 Platform
same as 2.2
After fixing the path in 4.2.2, I could create new project successfully again.
For some reason, if you install Android Studio in the same directory as the SDK, this error will pop up. Just install it somewhere else.
For instance, I had it installed at C:\Android\, along with the SDK. Then, I decided to install it at C:\Program Files (x86)\Android Studio and it simply worked.
I am trying to install the Android Support package (previously known as the Android Compatibility Library, I think) using the SDK Manager, but it keeps (silently) failing to install.
According the the documentation, it should install to my /extras/ directory, but after what looks to be a successful download and installation from the SDK, the directory is empty. There are no errors in the SDK Manager log, and the module says that it is installed in the list of "extra" packages......but it is not!
Has anyone else had any experience of this?
I'm using Wnidows Vista + Eclipse.
Cheers,
Chris
So - couldn't figure out why the SDK Manager won't install it, but I did find this link on StackOverflow that explains how to manually download packages from the Google repository (this is explained in an external blog here)
This means that I can at least download the .zip file and install it manually!
Try to run the SDK as admin from the location you had installed.
Alternatively, you could just not use eclipse at all and add the .jar to your build path manually.
Create a directory called "libs" in your project explorer.
Drag and drop the support package file (.jar) into your new "libs" directory.
Right click the .jar file and click "add to build path".
And there you have it :)
I am trying to make Android programs using IntelliJ. Unfortunately, I cannot get the Android SDK to be recognised on IntelliJ. (I.e. Eclipse has Android SDK Manager installed just fine.)
I select create new project from scratch.
I give the project a name and select make Android module.
Create source directory (next).
The computer then shows Android SDK none. I click the ellipses (...) and the program can see my JDK files.
I click on the + and select Android SDK.
I then find the directory c:\Program Files (x86)\Android\android-sdk.
However, when I click OK a dialog box appears stating "Please select Java SDK". It only gives me the choice of 1.6 (and not the other one 1.7). I then press OK for 1.6.
Finally the computer then reports it cannot find any Android targets in this SDK.
Please help!!!!
Before creating a new Android Project on IntelliJ Idea, you need to configure the Java and Android Development Kits at the IDE level.
Assuming you already installed the JDK and the Android SDK and you just launched IntelliJ (I'm using version 13.0.2):
Press Ctrl+Shift+Alt+S (to access the Project Structure dialog)
On the left navigation pane, click on 'Project Settings->Project'
On the right navigation pane, you should see a drop-down list displaying '<No SDK>'
Click on 'New', select 'JDK' and choose the path to your JDK
Click on 'New', select 'Android SDK' and choose the path to your Android SDK
Please note you have to define the JDK before the Android SDK.
This procedure is documented at:
https://www.jetbrains.com/idea/webhelp/configuring-global-project-and-module-sdks.html
On linux, run tools/android under the SDK to run the Android SDK Manager. Then download one or more of the platforms. Check out "SDK Readme.txt" in the SDK directory for more. Once you're done there, you will be able to select a platform, and your IntelliJ system will start to run.
For others who may encounter this issue on Intellij14 + Mac - the solution that worked for me was to
1) Open intellij - select add android sdk from the project settings section, select the android-sdk-macrox root directory
2) the sdk manager pops up - download at least 1 package.
3) Restart intellij (without this restart, it didnt seem to work)
Oddly, IntelliJ 12 Community doesn't give us the option to select the JDK location for Android projects.
I've found a workaround for this:
First, create a new Java project. I used 'Java Hello World' project. This'll give you the chance to select your JDK.
Install the Android SDK and run the Android SDK Manager to install tools and a platform, as others have mentioned.
Create a new Android project. Under 'SDK', select the Android SDK. Intellij will remember the JDK location you defined in step #1.
On Mac, IntelliJ won't detect the installation of Android SDK. When selecting SDK for new Android module, select your android-sdk-macosx folder as your location.
More info: https://peterboctor.wordpress.com/2010/12/02/installing-the-android-sdk-on-mac-os-x/
Alternatively, Google just releases Android Studio which is a whole IDE base on IntelliJ.
With IntelliJ IDEA 14.1.2, I couldn't select the Android SDK install location on Mac OS X. That install location was ~/Library/Android/sdk, which IntelliJ wouldn't navigate to because ~/Library is a hidden folder. So I created a symlink in my home directory (ln -s ~/Library/Android/sdk/ ~/AndroidSDK) and IntelliJ DID let me select that.
(linux, osx)
When going standalone (without Android Studio), make sure you have the sdk tools (from the standalone sdk, "command line tools" option), build-tools, platform-tools and an sdk (platform).
./tools/bin/sdkmanager --update
# list available packages (pick a version)
./tools/bin/sdkmanager --list
# install requeriments
./tools/bin/sdkmanager "build-tools;26.0.0"
./tools/bin/sdkmanager "platforms;android-26"
# you might get wrong permissions from the downloaded packages
sudo chmod -R +rxw tools # will need write perm to create AVDs
This may help others. I found that I couldn't get IntelliJ (MacOS) to recognise the Android targets in the android-sdk-macosx folder. Moving the Android SDK folder out of the Applications folder and into a directory in my User's folder resolved the issue. IntelliJ was then able to recognise the Android SDK. It may have had something to do with permissions, but no errors were shown to indicate this. Hope this helps.
I had the same problem with version 15 intelliJ after upgrading on OS Linux Ubuntu 12.04
I found because the android sdk wasn't in the home folder of the user running intelliJ that you had to change the Folder/file permissions before it would see this
Mine was in the root
Issuing the command chown -R <yourusername> /path/to/android_sdk_dir
solved the problem for me
If this fails after doing this delete the ~/.ideaC(Lastversion number) any previous ~/.ideaC(Lastversion numbers) folder's and then re open intelliJ
You will have to go through the initialization of the IDE and give the path to your Java installation ver8 upwards only on intelliJ version15 and thereafter your android sdk installation
I found this can also cause conflicts
As a further tip add the following to the very end of your ~/.bashrc using one of your editors my (nano , vi etc )
Example vi ~/.bashrc
The following lines set the Android Path
PATH=$PATH:/path/to/android/:/path/to/android/tools
export PATH
For SDK version r_08 and higher, also add these two lines for adb:
PATH=$PATH:/path/to/android/platform-tools
export PATH
for setting android emulator to 32 bit version add this line
export ANDROID_EMULATOR_FORCE_32BIT=true
Exit your choice of editor (vi , nano etc ) and
Re invoke bashrc with the command below
source ~/.bashrc
Hope that helps you
You need to run SDK Manager.exe to download at least one of the platforms, then you'll be able to select the downloaded platform, see also this tutorial.
If you are behind a proxy server :
1.After starting the Android-SDK-Manager, go to :
Tools > Options.
Add your proxy details.
2.Then go to Packages > Reload
3.After this you should be able to see all the platform options of the Android.
PS : Pheew! Spent an hour figuring this out!
You can create symlink to your sdk location, even to hidden folder. And then point point IDEA to symlink.
For example: ln -s /Users/*username*/Library/Android/sdk /Users/*username*/androidsdk