Android Studio 更新 0.5.3 - 找不到平台“android-19”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22761027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio update 0.5.3 - platform 'android-19' not found
提问by Supercelo
Yesterday I opened Android Studio and it asked me to be updated. I now have v0.5.3, SDK 19 fully installed and gradle 0.9.+. I think this information is correct but I'm not fully aware how the gradle strategy works.
昨天我打开 Android Studio,它要求我更新。我现在已经完全安装了 v0.5.3、SDK 19 和 gradle 0.9.+。我认为这些信息是正确的,但我并不完全了解 gradle 策略是如何工作的。
The problem is that my gradle apps stopped syncing and even when I create a brand new project it does not sync. Here are the details:
问题是我的 gradle 应用程序停止同步,甚至当我创建一个全新的项目时它也不会同步。以下是详细信息:
Project's build.gradle:
项目的 build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
App's build.gradle:
应用程序的 build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
In SDK ManagerI have all the builds installed including 19.+.
在SDK Manager 中,我安装了所有版本,包括 19.+。
The errorI get when syncing:
该错误同步时,我得到:
Failed to set up SDK
Error:Module 'app': platform 'android-19' not found.
Information:Double-click here to open Android SDK Manager and install all missing platforms.
I know that if I change
我知道如果我改变
compileSdkVersion 19
compileSdkVersion 19
to
到
compileSdkVersion 18
compileSdkVersion 18
in the app's build.gradle it works... but I don't think that's the solution.
在应用程序的 build.gradle 中它有效......但我认为这不是解决方案。
Thanks!
谢谢!
回答by cholm
I had the same problem.
我有同样的问题。
Deleting ~/.AndroidStudioPreview
(on Debian GNU/Linux 'sid') fixed the problem. This directory was from an older version of AS (0.3.x). I don't know what the equivalent of the GNU/Linux ~/.AndroidStudioPreview
is on Windows/Mac OS X/... (for Windows it's under C:\Users\<user>\.AndroidStudioPreview\
).
删除~/.AndroidStudioPreview
(在 Debian GNU/Linux 'sid' 上)修复了这个问题。该目录来自旧版本的 AS (0.3.x)。我不知道 GNU/Linux~/.AndroidStudioPreview
在 Windows/Mac OS X/... 上的等价物是什么(对于 Windows,它在 下C:\Users\<user>\.AndroidStudioPreview\
)。
回答by A23
Deleting the following fixed my problem -
删除以下内容解决了我的问题 -
~/Library/Caches/AndroidStudioPreview
~/Library/Caches/AndroidStudioPreview
~/Library/Logs/AndroidStudioPreview
〜/图书馆/日志/AndroidStudioPreview
~/Library/Preferences/AndroidStudioPreview
~/Library/Preferences/AndroidStudioPreview
回答by Ajay S
Update your Android SDK tools to version 22.6.2, and install android-19. It worked for me!
将您的 Android SDK 工具更新到版本 22.6.2,并安装 android-19。它对我有用!
Go to your Module Settings
and set project SDK.
转到您的Module Settings
并设置项目 SDK。
回答by ade.se
Had this problem too in 0.5.3 and the only way I could fix it was to downgrade to 0.5.2.
在 0.5.3 中也有这个问题,我能解决的唯一方法是降级到 0.5.2。
Even though I added the SDK manually in the project structure window, it would not import android class files properly.
即使我在项目结构窗口中手动添加了 SDK,它也无法正确导入 android 类文件。
0.5.2 is available here: http://tools.android.com/download/studio/canary/0-5-2
0.5.2 在这里可用:http://tools.android.com/download/studio/canary/0-5-2
回答by Caue Ferreira
Just found out that updating the SDK platform 19 to revision 3 solved this problem for me. For instance I'm using Android Studio 0.5.4 as well.
刚刚发现将 SDK 平台 19 更新到修订版 3 为我解决了这个问题。例如,我也在使用 Android Studio 0.5.4。
回答by GeralexGR
Delete your .AndroidStudioPreview folder and run Android Studio again. Unfortunately you will lose your settings.
删除您的 .AndroidStudioPreview 文件夹并再次运行 Android Studio。不幸的是,您将丢失您的设置。
回答by Rob
I was able to just open the SDK Manager and install the updates it found. I had installed new things recently, yet it found six new packages to install. My guess is the new version of the SDK tools is what fixed the gradle problem. Works fine now. No downgrade, no hidden file deletions.
我只能打开 SDK Manager 并安装它找到的更新。我最近安装了新东西,但它找到了六个要安装的新软件包。我的猜测是新版本的 SDK 工具解决了 gradle 问题。现在工作正常。没有降级,没有隐藏文件删除。
Wait, I was installing 0.5.4 not 3.
等等,我安装的是 0.5.4 而不是 3。
回答by bluehallu
Go to the SDK manager and install Extras -> Android Support Repository
转到 SDK 管理器并安装 Extras -> Android Support Repository
回答by Gene
I had the same problem but my reason was because I had two SDK Managers and my Android Studio had the wrong SDK Manager directory.
我有同样的问题,但我的原因是因为我有两个 SDK 管理器,而我的 Android Studio 有错误的 SDK 管理器目录。
The first SDK Manager was from my Eclipse-Android SDK that I installed a few years back. The directory it is located in is C:\Program Files (x86)\Android\android-studio\sdk
第一个 SDK Manager 来自我几年前安装的 Eclipse-Android SDK。它所在的目录是 C:\Program Files (x86)\Android\android-studio\sdk
The 2nd SDK Manager was for my Android Studio. The directory it is located in is C:\Users\Gene\Android SDK\sdk
第二个 SDK 管理器用于我的 Android Studio。它所在的目录是C:\Users\Gene\Android SDK\sdk
In Android Studio, go to File -> Project Structure. On the left tabs, choose “SDK Location”. Make sure you're pointing the project at the right SDK Location.
在 Android Studio 中,转到文件 -> 项目结构。在左侧选项卡上,选择“SDK 位置”。确保您将项目指向正确的 SDK 位置。
If you need to access the SDK Manager for Android Studio in order to download more APIs, you might need to right click on “SDK Manager.exe” and then click “Run as administrator” in order for you to get it to work.
如果您需要访问适用于 Android Studio 的 SDK Manager 以下载更多 API,您可能需要右键单击“SDK Manager.exe”,然后单击“以管理员身份运行”以使其工作。
Whatever SDK Manager you are using, make sure you downloaded the API for it before you set "compileSdkVersion" (in gradle) to that API version.
无论您使用什么 SDK Manager,请确保在将“compileSdkVersion”(在 gradle 中)设置为该 API 版本之前为其下载了 API。
回答by Daniele
Had the same problem after clean install of Android Studio 1.1.0 on OSX Yosemite. Deleting folders did not work. What did work was simply run sudo android
, from terminal.
在 OSX Yosemite 上全新安装 Android Studio 1.1.0 后遇到了同样的问题。删除文件夹不起作用。所做的工作只是sudo android
从终端运行。