在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
当前回答
我在Android Studio 4.0.1上得到这个错误。这是我的解决方案:去你的构建。gradle(Module: app)文件,然后更新compileSdkVersion和buildToolsVersion。
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
}
其他回答
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.
在Mac上按“⌘+Shift+A”(在Windows上按“Ctrl+Shift+A”),并在弹出的EditText中写入“将项目与Gradle文件同步”。然后双击出现的选项。然后它将同步您的Gradle文件SDK与项目文件。
在Android Studio 3及以上版本中,适用于Windows、Mac和Linux:
File -> Sync Project with Gradle Files
解决了!
或者你可以通过快捷键来完成:
按⌘+ Shift + A (Mac)或Ctrl + Shift + A (Windows, Linux)。然后弹出编辑文本并写入“同步项目与Gradle文件”。然后双击该选项。
你的问题解决了!它会同步你的gradle文件和你的项目文件。
截图:
在最新的android studio 3.3.2中,Gradle文件同步项目的图标发生了变化
现在试试这个
文件->同步项目与Gradle文件(Android Studio 3.3.2)
从Android 3.2.0开始,菜单结构和选项略有变化。我通过更改下面菜单中的模块SDK来修复这个错误:
>项目结构>模块>应用文件>依赖选项卡>模块SDK
确保点击Apply保存更改。