在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
在成功地将Eclipse-Android-Project导入到“Android Studio 1.4”后,我得到了错误
"Please select Android SDK"
当我点击按钮在模拟器中运行应用程序时,我找不到任何方法来这样做。
当我点击“run”时,这个对话框就会打开:
这是“项目结构”对话框:
我现在该怎么办?
当前回答
如果您正在使用'配置文件或调试APK…,那么你可能会遇到这个错误。
我的解决方案是首先在SDK管理器中检查SDK的更新:点击SDK位置右侧的“编辑”,然后安装任何更新:
然后我点击了Android Studio底部的“Logcat”,发现我也需要配置Android SDK,所以选择最新的Android API平台:
在那之后,我能够在模拟器中运行APK。
其他回答
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与项目文件。
最后,我重新导入了这个项目,它工作了。
您正在使用谷歌API SDK。出于某种原因,这在嵌入式java JDK / JRE中不再有效。
按照我在这里描述的解决方案,将Android Studio JDK路径设置为本地JDK(例如OpenJDK)。
如果你的android SDK路径是给定的,但你仍然面临这个问题,那么这可能是因为你的android工作室没有很好地同步,即使你点击了“立即同步”链接。
为了重新同步,去到app gradle文件,做些改变,或者给一个空间,然后再同步。它会完美工作的。