Android sdk setup [duplicate] - android

How do I set up IntelliJ IDEA for Android applications?

I've spent a day on trying to put all the pieces together, been in hundreds of sites and tutorials, but they all skip trivial steps.
So here's the full guide:
Download and install Java JDK (Choose the Java platform)
Download and install Android SDK (Installer is recommended)
After android SD finishes installing, open SDK Manager under Android SDK Tools (sometimes needs to be opened under admin's privileges)
Choose everything and mark Accept All and install.
Download and install IntelliJ IDEA (The community edition is free)
Wait for all downloads and installations and stuff to finish.
New Project:
Run IntelliJ
Create a new project (there's a tutorial here)
Enter the name, choose Android type.
There's a step missing in the tutorial, when you are asked to choose the JDK (before choosing the SDK) you need to choose the Java JDK you've installed earlier. Should be under C:\Program Files\Java\jdk{version}
Choose a New platform ( if there's not one selected ) , the SDK platform is the android platform at C:\Program Files\Android\android-sdk-windows.
Choose the android version.
Now you can write your program.
Compiling:
Near the Run button you need to select the drop-down-list, choose Edit Configurations
In the Prefer Android Virtual device select the ... button
Click on create, give it a name, press OK.
Double click the new device to choose it.
Press OK.
You're ready to run the program.

The 5th step in "New Project' has apparently changed slightly since.
Where it says android sdk then has the drop down menu that says none, there is no longer a 'new' button.
5.)
a.)click the ... to the right of none.
b.)click the + in the top left of new window dialog. (Add new
Sdk)
c.)click android sdk from drop down menu
d.)select home directory for your android sdk
e.)select java sdk version you want to use
f.)select android build target.
g.)hit ok!

Once I have followed all these steps, I start to receive error messages in all android classes calls like:
I revolved that including android.jar in the SDKs Platform Settings:

I had some issues that this didn't address in getting this environment set up on OSX. It had to do with the solution that I was maintaining having additional dependencies on some of the Google APIs. It wasn't enough to just download and install the items listed in the first response.
You have to download these.
Run Terminal
Navigate to the android/sdk directory
Type "android" You will get a gui. Check the "Tools" directory and the latest Android API (at this time, it's 4.3 (API 18)).
Click "Install xx packages" and go watch an episode of Breaking Bad or something. It'll take a while.
Go back to IntelliJ and open the "Project Structure..." dialog (Cmd+;).
In the left panel of the dialog, under "Project Settings," select Project. In the right panel, under "Project SDK," click "New..." > Android SDK and navigate to your android/sdk directory. Choose this and you will be presented with a dialog with which you can add the "Google APIs" build target. This is what I needed. You may need to do this more than once if you have multiple version targets.
Now, under the left pane "Modules," with your project selected in the center pane, select the appropriate module under the "Dependencies" tab in the right pane.

Just in case someone is lost. For both new application or existing ones go to File->Project Structure. Then in Project settings on the left pane select Project for the Java SDK and select Modules for Android SDK.

Another way to identify the correct SDK is to install Android Studio, create a new project, go to project structure, SDK Location and find where the SDK was installed.
I found using the default installation process on a mac that the SDK home folder was in the /Users/'yourUser'/Library/Android/sdk folder. Make sure you have enabled your Mac to view the Library folder.

You just need to install Android development kit from http://developer.android.com/sdk/installing/studio.html#Updating
and also Download and install Java JDK (Choose the Java platform)
define the environment variable in windows System setting https://confluence.atlassian.com/display/DOC/Setting+the+JAVA_HOME+Variable+in+Windows
Voila ! You are Donezo !

Related

Errors after updating sdk with Eclipse

Well i've decided to update the sdk using sdk manager. I've updating at the last android M preview API. After that, i re opened Eclipse and all my projects had errors!! The appcompat library returns in the console this:
android-support-v7-appcompat] /android-support-v7-appcompat/gen already exists but is not a source folder. Convert to a source folder or rename it.
I really don't know what it means! But i can't work now!
the problem is in the ADT you must update it to a version above 23... it seems that they (Android guys) are making our life harder, they want us to migrate to their tool (Android studio)
you can follow those steps:
first of all download the ADT Plugin zip file and do not unpack it.
then, Start Eclipse, and select Help > Install New Software.
Click on " Add ", in the top-right corner and in the Add Repository dialog, click on " Archive ".
you must select the downloaded ADT-23.x.x.x.zip file (the_latest_one_available) and click OK.
After that enter "ADT Plugin" for the name and click OK. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
Then in the next window, you'll see a list of the tools to be downloaded. So you will click Next.
Accept the license agreements (no one read it :-) ), then click Finish.
Note that if you get a security warning saying that the authenticity or validity of the software can't be established don't care about that, just click OK.
After completition, restart Eclipse and Voila, it must be done.... I hope so...
i will post another answer and not editing the first one because it's another different approach: you can Undo update your sdk for this you can:
Download the older ADT plugin manually (the one who was working fine, don't forget to check if you haven't it already in your downloads folder). Then copy the tools folder from there and replace the tools folder in your SDK installation directory.
Your SDK will be back to the older working version.

Android Studio SDK location

I see there a lot of similar topics pertaining to this issue but I did not find a solution for me among those posts. I just installed Android Studio v0.8.14 and it won't let me create a new project because I do not have an SDK path specified. For the life of me I cannot find where that path should be. I see many people have it located in C:/Android or someplace similar, however the only Android files I have are on my desktop in the extracted folder that came in the .zip. All paths inside that folder do not qualify as an appropriate SDK location, according to Android Studio. Am I being completely ridiculous and missing the obvious?
For Mac/OSX the default location is /Users/<username>/Library/Android/sdk.
Android Studio on Windows 8:
C:\Users\username\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe
(in username : please enter valid username)
Install it and restart your Android Studio.
The above steps are similar for win 7 and also same for eclipse.
Update: Windows 10 (similar steps) - pointed out by RBT
This is the sdk path Android Studio installed for me:
"C:\Users\<username>\appdata\local\android\sdk"
I'm running windows 8.1.
You can find the path going into Android Studio -> Configure -> SDK Manager -> On the top left it should say SDK Path.
I don't think it's necessary to install the sdk separately, as the default option for Android Studio is to install the latest sdk too.
I had forgot where the sdk location was installed to so what I did was open Android Studio and selected Settings then used the following submenu
Current 1/1/2017:Tools -> SDK Manager
outdate: Appearance & Behavior -> System Settings -> Android SDK
There the sdk location was listed as Android SDK Location
Download the SDK from here: http://developer.android.com/sdk/ to C:\android-sdk\.
Then when you launch Android Studio again, it will prompt you for the SDK path just point it to: C:\android-sdk\.
Update: new download location, https://developer.android.com/studio/#command-tools
Linux (Ubuntu 18.4)
/home/<USER_NAME>/Android/Sdk
windows (8.1)
C:\Users\<USER_NAME>\AppData\Local\Android\sdk
(AppData folder is hidden, check folder properties first)
macOS (Sierra 10.12.6)
/Users/<USER_NAME>/Library/Android/sdk
macOS (Catalina or Mojave or Sierra):
After installing Android Studio (3.6+ or 2.3.x),
by default
sdk path: "/Users/< username >/Library/Android/sdk"
Remember:
may be
Library folder is hidden.
To make it visible:- Hit Command+shift+. OR
Open Terminal and type "chflags nohidden ~/Library/" then hit return.
windows:
After installing Android Studio,
by default
sdk path: "C:\Users< username >\AppData\Local\Android\sdk"
Remember:
by default
AppData folder is hidden, make it visible first.
Start Android Studio and select Configure --> SDK Manager
Then, check the path of Android SDK
If you can't find the SDK location, you may want to download it. Just scroll down to near end of the download page and select the Android SDK with respect to your OS.
C:\Users\Max\AppData\Local\Android\sdk\
The location I found it in for Windows 8.1. I think the default SDK folder. AppData is a hidden folder, so you will not locate it unless you type it in once you get into your C:\Users\ folder.
For Mac users running:
Open Android Studio
Select Android Studio -> Preferences -> System Settings -> Android
SDK
Your SDK location will be specified on the upper right side of the
screen under [Android SDK Location]
I'm running Android Studio 2.2.3
When i upgraded i just moved my SDK to my user folder C:\Users\Nick\Android-SDK and updated my path in Android Studio. Worked like a charm.
EDIT: (More detail) - My SDK was originally inside C:\Program Files (x86)\Android\android-studio\sdk, I just Cut and Paste the entire \sdk folder into C:\Users\Nick\Android-SDK, then set it inside Android Studio to the new location.
For Ubuntu users running:
Open Android Studio
Select Android Studio -> Settings -> Android SDK or
Android Studio -> Project structure -> SDK location or to open Project structure shortcut is (Ctrl+Alt+Shift+s)
Your SDK location will be specified on the upper right side of the screen under [Android SDK Location]
If your project is open click on Gradle Scripts >local.properties(SDK LOCATION), open it and there is the location of sdk with name
sdk.dir=C\:\\Users\\shiva\\AppData\\Local\\Android\\Sdk
Note don't forget the replace \\ to \ before coping the things(sdk location)
Default path in Windows
%USERPROFILE%\AppData\Local\Android\Sdk\
Linux 2021, after installed follow these steps!
Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
In the left panel, click Appearance & Behavior > Android SDK.
You will see the path
C:\Users\username\AppData\Local\Android\sdk
This is the right path, if you looking up for sdkmanager.
Android SDK is in C:\Users\username\AppData\Local\Android\Sdk
(MAC Users) To find sdk Location in Android Arctic Fox:
File >> Project Structure>> SDK Location.
Consider Using windows 7 64bits
C:\Users\Administrador\AppData\Local\Android\sdk
Windows 10 - when upgrading from AS 2.x to 3.01
AS has the SDK directory name changed from .../sdk to .../Sdk
Because I kept my original settings this caused an issue.
Changed back to lowercase and all working!
AndroidStudioFrontScreenI simply double clicked the Android dmg install file that I saved on the hard drive and when the initial screen came up I dragged the icon for Android Studio into the Applications folder, now I know where it is!!! Also when you run it, be sure to right click the Android Studio while on the Dock and select "Options" -> "Keep on Dock". Everything else works.
create a new folder in your android studio parent directory folder. Name it sdk or whatever you want.
Select that folder from the drop down list when asked.
Thats what solves it for me.
I tried the accepted solution but it didn't resolve the issue for me.
I had already installed Android Studio 2-3 years ago, but I uninstalled it at some point. Installing the latest version was giving me an error. I did multiple uninstalls/reinstallations, but the issue persisted.
I found an SDK was available on my machine in %LocalAppData%. I opened the environment variable and deleted all the references of Android like Android Home /Path. I performed the uninstallation of Android Studio and then reinstalled.
This time it worked and installed properly; it is even downloading the other SDK-related files.
If you are working on React native,please make sure you have installed these tools because I was missing and it resolved my issue
React Native doc for installation
I found this a couple of minutes back.
What renders the location unuseful is the fact that it is neither empty nor has the sdk.
One of the conditions needs to be met for the folder.
So, try this:
On Windows, go to Control Panel and search for 'show hidden folders and files'.
You will find a "Folders" option. On the submenu, you will see "Show hidden files and
folders".
[The options look like this.][1]
Refer this image.
[Click the option shown in the picture][2]
Click apply and ok.
Go to the location i.e. some location in appdata, or the location your android sdk was
about to be installed in. The location should be visible now.
Go to it and delete everything inside. (Don't delete the sdk folder, just the contents
inside it )
Go to android sdk manager and select the same location again. The error should vanish.
Happy installation!
In other words, this error only pops up if you had a previous failed installation.
If you're unable to do it still, hit me up at twitter #Vishma Pratim Das and I will be happy to assist you.
Thanks.
[1]: https://i.stack.imgur.com/G6P8S.png
[2]: https://i.stack.imgur.com/PeRUZ.png
I just installed Android Studio and has the same problem.
Banged my head for a few hours and found the solution - it's retarded.
So I installed Android Studio but when it asked me for the config folder, I provided the one from my IntelliJ. Well, turns out that stop the Android Studio setup and I had no SDK. Going to their site the SDK is nowhere to be found. It's not on any of the links from the other answers either.
My solution was to use a different folder for Android Studio. That ran the setup wizard and downloaded the SDK.
Sharing what worked for me in hopes that it helps someone else.
My issue was that my SDK was not installed together with the Android Studio IDE for some reason. How I managed to trigger the SDK installation was by going to File > Settings on Android Studio, then typing "sdk" in the searchbar. If your android sdk location is empty, click on "edit" right next to it and it should immediately prompt installation for your sdk.
Cheers!
For Linux, do not move/put android sdk under /usr/lib/ directory because it will only have read permissions and other libraries cannot be downloaded.
C:\Users\username\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe
check this location in windows

Eclipse cannot find Android Support Library

I am an experienced programmer but new to Android, hence using Eclipse for the first time.
Unfortunately I cannot get my first project off the ground. I get as far trying to create the project when the following sequence happens.
A screen arrives titled 'Install Dependencies' telling me that the required version is 8 and the installed version is 'Not installed'
I click on the Install/Upgrade button and something must happen because Android SDK Manager pops up and I get a whole series of 'Fetching:' messages.
The next screen asks me to Choose Package to Install and the only option is Android Support Library, revision 10. This doesn't bother me as I presume 10 is better than 8 so I hit the Install button.
This is where it all goes wrong as I get a red message saying:-
File not found:C:\Program Files (X86)\Android\android-sdk\temp\support_r10.zip (Acces is denied).
Sure enough, when I check this folder, it is empty.
Now, something must have happened as as SDK Manager did a whole lot of fetching and must have put these files somewhere.
I am quite happy to find them and put them in the correct folder but the question is
What is the name of the files that I am looking for?
Run SDK Manager as administrator and then install Android Support Library from Extras
Download the sdk manager seperately and install files from there. put it in a place which is accessible to you and then point your eclipse android directory to it. tools>options>android sdk
Run eclipse as Administrator. This is the solution.
Try running your application (Eclipse) in Admin Mode.
Right click on the Eclipse app, and choose "Run as Administrator"
This will fix your problem.
properties >java build path >click library tab > add jars > add jars from the support library.

How to create New Android Virtual Device (AVD) on Mac?

I am using android-sdk-macosx to download from the internet, then installed Android SDK 2.2 and 2.1 successfully, then I tried to create new AVD on mac, but I don't have any idea about how to create AVD.
I tried this below mentioned for your reference:
Fig 1.0 Create new AVD
Fig 2.0 I tried to open SDK and AVD Manager in eclipse menu Window --> Android SDK Manager
In Eclipse, go to Windows Menu , Select Preference Option so, following dialog box will appear. Just select the Android-SDK folder using Browse Button.
After doing this step click on the "Apply Button",
Now, you will be able to create new AVD in your eclipse.
Note, I have upload this image using Windows System, but i am sure, MAC has some, same kind of menu option.
Follow this seven steps to fix this issues:
1. Start Eclipse, then select Help > Install New Software.
2. Click Add, in the top-right corner.
3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
https://dl-ssl.google.com/android/eclipse/
Click OK.
4. If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
5. In the next window, you'll see a list of the tools to be downloaded. Click Next.
Read and accept the license agreements, then click Finish.
6. If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
7. When the installation completes, restart Eclipse.
It looks like you need to configure Eclipse to tell it where the android-sdk-macosx directory is (this can be done in 'Window>Preferences>Android> SDK Location".
Also, take a look at this page.
In the screenshot Fig 4.0, there's an error message at the top of the widow, which probably explains why the apply button is not available.
While the message cannot be read completely, I think it says that your version of ADT (Android Developer tools) does not match your version of the SDK : I might want to try updating both .
Also, take a look at this question, which might be about the same problem.

IntelliJ IDEA - Android JDK doesn't work

I've just installed IntelliJ IDEA 10.0.0.2 Community edition
I've installed Android SDK ... (C:\Program Files\Android\android-sdk-windows)
I want to make a new android project, so I a create a new project, select Android Module, next , next...
Then when i need to choose the JDK, I go to the android folder, and when i try to choose it, I get this error:
The selected directory is not a valid
home for JSDK
What am I doing wrong ? what can i do to fix this ?
I Installed android SDK with all the updates
When I choose IntelliJ IDEA Plugin SDK i get:
The selected directory is not a valid
home for IntelliJ IDEA Plugin SDK
EDIT:
Still not solved...
I've already chose the SDK itself and chose android 2.2 Platform when creating the project.
Can't load the JDK files. So i won't me compile, i get this error
Cannot start compiler: the SDK is not
specified for module "blah".
Specify the SDK at Project Structure
dialog.
To develop Android applications in IntelliJ IDEA you need to set both Java SDK (JSDK) and Android SDK:
Configuring Project SDK
Java SDK
Setting Android SDK/Platform
You also need to run SDK Manager application and download Android platforms which you are going to use.
Note that you can detach all the jars from the JSDK configuration in IDEA if you are going to use it only for Android, this will help with the code completion so that only classes available in Android will be suggested by the IDE.
I also recommend to read the following tutorials:
Developing applications for Android in IntelliJ IDEA
Developing Android applications on the base of existing sources
EDIT:
Configuring project's link has been updated
JSDK is the Java SDK. On my Debian it's under /usr/lib/jvm/java-6-sun
My installation path was "C:\Users\User\AppData\Local\Android\android-sdk." That confused IDEA since it doesn't seem to be able to see hidden folders, even when typing in the full path. Bummer...I fixed it though, by setting AppData as visible.
I just wasted a whole lot of time on this problem. My work station is running IntelliJ Ultimate 11 on Windows 7 64-bit. I was setting up my first Android project. Therefore, no SDKs were configured. First I selected the JDK, which was a no-brainer (C:\ProgramFiles (x86)\Java\jdk1.6.0_30). Next comes the part where you need to specify the Android SDK. First you click the elipsis ("...") and then click "Add New". Now here's the kicker... If you look carefully at the dialog box, you'll notice that "Configure new JSDK" is highlighted by default. What you need to do is change the selection to "Android SDK". Now you can select the directory of your Android SDK and you won't get that stupid error message.
I literally wasted about a half an hour before I realized why the app kept telling me "This is not a valid SDK directory." Hopefully this will help someone else having the same problem.
Don here: I had the same trouble in Windows 64 with 11.1.2 and 64bit java. found that only by clicking on the left window could I register my Android SDK.
When you first create Android project/module, you must choose JDK, for this click "+" and select "JSDK" in menu, then select where your Java SDK is, for instance "c:\Program Files\Java\jdk1.6.0_20". Then click "Next" and in "SDK Properties" panel click "New" and select path to your Android SDK (a directory where "SDK Manager.exe" is).
Click the + symbol in the left most pane in the Select android sdk window during the creation of the project and then select the android SDK (default= c/program files/android/android-sdk)
I had a real hard time seeing how to do this on a mac, since you can't download the jdk from sun's site
#Szabolcs Berecz #Yochai On a mac, you'll need to get the source as described here:
or just jump to the download here:
Then it stored in this location:
1.6.x /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar
If you right click in the leftmost window you can create a new Android Plugin or some such. I was just fighting with this myself. I have never used IntelliJ before and really their docs are out of date. Apparently not up to the current version.
In the JDK part you need to choose the JAVA JDK that was downloaded. (not the android)
C:\Program Files\Java\jdk1.6.0_24\
Make sure you have installed JDK 1.5 or 1.6
(1.7 is not works for some reason with Android SDK).
I had the same problem ("The selected directory is not a valid home for Android SDK"),
but after installing 1.6 JSDK - it`s work for me.
I've got the same problem with version 12 on linux, Android module does not show java sdk location and android sdk location selection fails because java sdk is not set.
I've solved by making a java project, that lets me select java sdk and android sdk (strange right?), after making such a project I can make an android project because android sdk is now configured
I've spent 30 minutes solving a foolish problem
For IntelliJ & Android on Linux.
If the "Android SDK" Menu comes up with a red 'No Android SDK' Click the browse button to the RIGHT of the drop down. - Its a different layout in Linux to Windows.
In my case, I needed to add support for android, so, I searched for android in the plugins settings.
Fixed! I needed to run IntelliJ as Administrator IDEA. Now it will approve my Android SDK directory of "C:\Program Files (x86)\Android\android-sdk"

Categories

Resources