Cannot run my app, asking to select Android SDK

眉间皱痕 提交于 2019-12-06 07:16:38

问题


Today I've installed Android Studio Canary 1

Now I cannot run my app. This following dialog appears.

I've already set the right SDK location through File-> Project Structure-> Android SDK location.

Expecting your help to solve this problem.

Warning Dialog image:


回答1:


Go to project structure settings and set Source Compatibility and Target Compatibility to your current java development kit version:




回答2:


Just you need to sync your project file with your gradle file.

File -> Sync Project with Gradle Files



回答3:


Sometimes the SDK path will be incorrectly configured. You would need to fix it.

  1. To Settings/Preferences( command + , on mac).
  2. Search for SDK
  3. Under Android SDK, click on edit and point it the root of sdk directory on your file system. (If ther is no SDk installed then install in from the below list).




回答4:


I tried every answer in this post but my problem only got resolved when I made these steps:

File -> Close project -> Remove project -> Open existing project (same project)

Maybe this will save a morning to another person with the same bug.

EDIT

This happened to me a lot on a MacBook. After I posted this answer it just kept happening so what I did was:

  • uninstall the Android Studio version I had from the App Store;
  • download the desktop stable version from Android Studio website;
  • start using the desktop version of Android Studio.

Never happened again.




回答5:


Go to sdk manager and install sdk according to your device and check your device api. Example if your device is jellybean then install api 19 sdk.




回答6:


Go to Tools> Android > SDK Manager and make sure you have selected default Setting under System Setting. In this image I have selected Android 7.1.1 as default SDK




回答7:


i suggest you go to build.gradle and sync again. Or Tools -> Android -> Sync Project with Gradle Files (Android 3+)




回答8:


I had the same problem and what it worked for me was just sync with gradle. I just did what I've found in this similar question:

Android Studio: "Please select Android SDK"

The original answer:

go to build.gradle and click sync now. Then it worked.

Update :

File -> Sync Project with Gradle Files (Android Studio 3.1.1)

Tools -> Android -> Sync Project with Gradle Files (Android Studio 3.0.1) Or You can click on the icon from the toolbar.

Sync Project Icon

This answer may not help works for later version as Android studio Team work on making the tool more better, the way to sync may be

different in the next version of Android Studio.

COMMON WAY that may helps is try to sync project and then Invalidate Caches and Restart Android Studio.

Solution for Android Studio 3.1.2

Before that, by the way, I had invalidated cache and restarted too, but it didn't work. Please, try and make us know.

P.S. I had this problem after I imported a project from Git, just in case someone would like to replicate.




回答9:


Just click on the button ..."Sync Project with gradle file" Error will be remove



来源:https://stackoverflow.com/questions/44180266/cannot-run-my-app-asking-to-select-android-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!