【发布时间】:2014-05-10 18:14:06
【问题描述】:
昨天我打开了 Android Studio,它要求我更新。我现在已经完全安装了 v0.5.3、SDK 19 和 gradle 0.9.+。我认为这些信息是正确的,但我并不完全了解 gradle 策略的工作原理。
问题是我的 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()
}
}
应用的 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'])
}
在 SDK 管理器中,我安装了所有版本,包括 19.+。
同步时遇到的错误:
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.
我知道如果我改变了
compileSdkVersion 19
到
compileSdkVersion 18
在应用程序的 build.gradle 中它可以工作...但我认为这不是解决方案。
谢谢!
【问题讨论】:
-
我今天早上从全新安装的 Android Studio 中也看到了这一点,“错误:模块 'app':找不到平台 'android-19'”。截图:svm17250.vps.tagadab.com/img/as-issue.png你能解决这个问题吗?
-
我只能通过执行上面解释的操作来克服错误:将 compileSdkVersion 更改为 18
-
很奇怪...我不得不升级到 android-19 让它“工作”。
-
新更新没有解决问题。在 Android Studio 0.5.4 上同样的问题。
-
我唯一能做的就是回到 Eclipse。对不起,伙计们,但我无法指出任何对我有用的正确答案......
标签: android sdk android-studio sync build.gradle