android sdk is not specified in android studio - android

I am using android studio v1.5.1 on ubuntu. I have android API 16 and 23. I am trying to build a module using android studio but it complains that the android SDK is not specified.
When I open the project settings, I can see both android 16 and 23.
I cannot seem to figure out which one to select as default (or should I go ahead and delete the one I do not need).

You can set the (general) sdk location with:
- File -> Settings -> Android SDK (under Appearance & Behavior -> System Settings)
Also you can set the location for a project using:
- File -> Project Struture -> SDK Location
To set the level of the SDK, use your build.gradle file inside the module using:
android {
compileSdkVersion 23
//...
}

You can select more than one, like in screenshot below. They are packages that you have installed.
So no need to worry and no need to delete any similar will be in UBUNTU

I was able to get this done by using File -> Project Structure -> Modules -> Name of module -> Dependencies tab -> Selecting Module SDK -> Selecting the SDK I wanted to use (Android SDK 16) -> Apply. I was able to build the module after the change.

Related

Problem with debugging APK with Android Studio 3.1.4 on Windows

After selecting “Profile or Debug APK…” to open an existing APK, pressing the “Debug” button gets us to the “Edit Configuration“ windows with the “Error: Please select Android SDK” message.
If we still select “Debug”, and then select “Continue Anyway” in the “Change Configuration Settings” windows, the error notification from the main window is “Error running ‘com.appname’: No JDK specified for module ‘com. appname’”.
I found the solution for myself. There are 2 places to check if the SDK was set correctly.
File-> Project Structure… -> Project Settings -> Project
Ensure that Java SDK is set under “Project SDK”. (for example, ‘9.0.1 (java version “9.0.1”)’)
Project Settings -> Project (tab)
File-> Project Structure… -> Project Settings -> Modules -> -> Dependencies
Ensure that your installed Android SDK platform is set under “Module SDK”. (for example, Android API 27 Platform (java version “9.0.1”)’)
Project Settings -> Modules (tab)
If the application is debuggable, pressing the “Debug” button will bring up the Android emulator selection windows.

How do I run two instances of Android Studio with different preferences e.g. different SDK locations, different gradle versions

I happen to have two projects running on my Mac, A and B, where I need to compile A into B and then run B to see the changes. However, B uses a different SDK path from and uses a custom gradle, so I cannot open two Android Studio windows without the preferences conflicting.
I'm currently just coding on A while using the settings on B, and compiling via terminal, but I don't get to see the layouts since the custom gradle won't run correctly on A and won't render them.
Anyone has a workaround to this?
To change the sdk location in Android Studio :
File -> Project Structure (Ctrl+Alt+Shift+S) -> SDK Location
Then change the Android SDK Location
To change the gradle version in Android Studio :
Open the build.gradle file of the project
Go to dependencies -> classpath
Change the gradle version
enter image description here

Android Studio doesn't detect custom SDK

I'm developing an app to be executed in Datalogic devices. I'm following this guide to set up the environment. I have carried out all the steps, but when I try to run the app, Android Studio is not able to detect the Datalogic SDK and shows this error:
Error: Please select Android SDK
In build.gradle, I have this:
compileSdkVersion 'Datalogic:Datalogic SDK v1:23'
as the guide says. Of course I have installed the Datalogic SDK API 23 from SDK Manager and I can use all the Datalogic's classes.
In my app's Module Settings -> Compile Sdk Version I have selected the Datalogic's one but still not working. If I build the app with gradlew assemble everything works. So, it seems to be something about IDE configuration.
I have also tried to invalidate cache and restart.
I found a solution in #rocciax 's answer of this question:
File -> Settings -> Android SDK -> Android SDK Location Edit -> Next, Next
Done!

Import project in Android Studio from Eclipse

I installed new Android Studio 0.1.1 based on IDEA ide and tried Import code from Eclipse.
Go to Eclipse->Export->Grandle so it add gradle file
Open Android Studio and select Import Project and select my project folder with build.gradle file
Press Finish and get an Error: failed to find target android-15 (this is was parget of my project)
I go to system variables and change to %ANDROID_HOME% = d:\dev\android\android-studio\sdk\ (remove platform-tools from path)
And get new error: failed to find Build Tools revision 15.0.0
Also create another New Project and change Android SDK for it, but I still cant import project
I explore this problem and find the weak point: in file build.gradle I change next lines:
from compileSdkVersion 15 to compileSdkVersion "17"
from buildToolsVersion "15" to buildToolsVersion "17"
And it fix my problem with project import. I think it's problem in Eclipse export function. Build tools starts only from version 17 (in ADT 22), so it's imposible to find version 15.
Had same problem, now works. I did this:
Open android studio:
Tools -> android -> SDK manager then install the android 4.0.3 (API 15) and done.
It worked for me.
These simple steps worked for me:
Open new project (new not import)
Press F4
On the left Click on SDKs
Delete all SDKs
Click on +
Choose the SDK you are using for eclipse
Choose the right version
Click OK
Open your project using gradle file
Enjoy :)
This is an import problem. NOT an SDK Level issue.
You need version 22 of the SDK Manager before you attempt the export or it won't be in a format that Android Studio can consume.
Do you have updated SDK for Eclipse?
You need the Rev.22. After you downloaded it, you can Export the Project with a "build.gradle".
Migration of the Projects
Updating your SDK
Update SDK go to config settings, project settings then you will see SDK that isn't correct point to same place eclipse points to for SDK.
Worked for me.
Also it might help to reexport the project with new sdk
Update your android APIs using Android SDK Manager.It seems you have installed API lower than level 15.
For general 'import project' info, search for the word 'import' on
this install-guide document for Android Studio:
http://developer.android.com/sdk/installing/studio.html
EDIT: I've recently learned to use the 'import' dialog, so that I can
import projects from GitHub, which is very cool! (I first watched a tutorial
on YouTube titled 'git and github'). Then I learned that one needs to
use 'git' to "Clone" an entire GitHub repository (to bring a dir-tree full
of separate projects to your development machine). Then, you can navigate
into that sub-tree, to a given project of interest, and then use Android
Studio's 'import' dialog to play with that example project.
WOW, NEAT!
Hope this helps...
Had the same problem when Android studio 0.2.9 on mac and importing an old eclipse project:
By default, it uses /Applications/Android Studio.app/sdk as the android sdk location, instead of whatever you used to use.
On a per-project basis, you can go to the menu's File->Project Structure (command-;) and on the left you can change the project's sdk location.
To handle all projects (new or imported), before opening anything at the start screen click configure -> Project Defaults -> Project Structure -> (on the left) Android SDK to do the same. (re: https://stackoverflow.com/a/18409923/954643)
If you were starting from scratch without any android sdk setup and eclipse though, you'd have to download the missing SDKs via Tools->Android->SDK Manager.
I simply solved the problem by changing the project build target (Project properties->Android->Project Build Target).
In the file build.gradle change your compileSdkVersion to your current version. For me it is 23. Your buildToolsVersion would be the same number. Hence the only thing I had to do was
Change CompileSdkVersion 15 to CompileSdkVersion 23 in the build.gradle
From the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.

Eclipse Android Project no Target available

I just installed the latest version of Eclipse and the Android SDK. In the Android SDK Manager I installed everything, and in Eclipse I installed the ADT Plugin.
If I choose new Android project, I can't choose any Build Target. How can i select different build targets?
Thanks for your help!
I had the same issue and had to go to Eclipse > Window > Preferences > Android to set the Android SDK location (C:\Program Files\Android\android-sdk in my case).
You can see this post: android can not find a target
and
http://www.mail-archive.com/android-beginners#googlegroups.com/msg17763.html
first of all select SDK manager in the android folder, then a windows pops up automatically in which certain packages are selected, from which you can select the platform on which you want to develop you application..... it will take some time to download those packages
Then go to preference(Eclipse) -> select android from the leftbar -> select target in the right bar -> got to the program Files - > select android -> select sdk -> Finish
Before running you application perform the following steps ->
-> select project name from the project explorer
-> select run as -> run configuration -> select android configuration -> select project name and activity name to start with -> Select target tab from the above -> it shows the platform which you have installed -> select that platform -> select run
don't forget i struggled with it, always mention the activity name in the manifest file otherwise what ever you program, it will never comes on emulator, but shows error....
You have to open the SDK Manager in the location in which you installed the Android SDK and download individual build targets depending on the Android version you want to develop for.
See Step 4 Here: http://developer.android.com/sdk/installing.html
Perhaps you've missed Step 4. Adding Platforms and Other Components at http://developer.android.com/sdk/installing.html . Pay attention on it.
To fix this problem, open SDK manager thru programs or eclipse. It will show available packages to download. In that list don't select the latest one. Select Versioin 2.2(API 8). Then install all sub packages (there are six) inside that.
the same error for me, Just activate "Automatic Updates" in eclipse, restart, install the new update of eclipse, you will be notified> now you can select in the preference android: your folder and all target will be there

Categories

Resources