在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
当前回答
After opening my project in Android Studio, I opened the App version of the build.gradle file, located in the Gradle Scripts folder of the Project. When I hovered my mouse pointer over the buildToolsVersion number, a tooltip popped, indicating that the version of Android Build Tools needed to be upgraded (see screenshot). I changed the value of the buildToolsVersion to the one identified by the error (27.0.2) and the problem was solved. The original error (Please select Android SDK) went away and the project compiled successfully, again. Although this solution was mentioned previously, the exact steps seemed to be missing, so hopefully this clears up any doubt. I guess the root cause for this problem is that a new version of the build tools were released but Android Studio did not trigger any notification to me, which would have indicated that I should manually fix this (since Android Studio does not seeem to have the ability to upgrade this build.gradle file internally), which leaves the onus on the user to find the problem and fix it.
其他回答
点击这个图标来同步gradle
或者编辑你的gradle模块,然后同步
进入File >> ProjectStructure(⌘;)。这将打开这个窗口,然后选择应用程序模块。然后选择Compile SDK版本。选择最新的一个,然后单击apply。
对于这个错误,有多个命中和试验解决方案。其中一定有一个对你有用。 以下是解决方案:
1.
工具-> Android ->同步项目与Gradle文件(Android Studio 3.0.1)
去建造。Gradle和点击同步现在
点击锤子(构建)图标来同步Gradle 或者编辑你的Gradle模块,然后同步
文件->设置-> Android SDK -> Android SDK位置编辑-> . Android SDK
构建开放。Gradle文件,只需添加一个空格或按enter。然后同步 项目。
File ->使缓存失效/重新启动
有很多答案,我尝试使用其中一个解决方案,在构建中添加新的行。Gradle文件,但它没有工作。然后我将comileSdkVersion更改为另一个版本,然后将其更改为我拥有的版本。“同步”按钮出现。按下它,为我解决了问题。
它帮助了我:
1. close project
2. remove .idea/ folder
3. select "import project (Gradle, Eclipse ADT, etc.)"
环境:
Android Studio 3.1.3
OS Macos High Sierra 10.13.5
另一个答案不适合我。