Android Studio update 0.5.3 - platform 'androi

2020-02-20 06:23发布

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.

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:

Project's 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:

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 Manager I have all the builds installed including 19.+.

The error I 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

to

compileSdkVersion 18

in the app's build.gradle it works... but I don't think that's the solution.

Thanks!

12条回答
看我几分像从前
2楼-- · 2020-02-20 07:04

Delete your .AndroidStudioPreview folder and run Android Studio again. Unfortunately you will lose your settings.

查看更多
Summer. ? 凉城
3楼-- · 2020-02-20 07:07

Deleting the following fixed my problem -

~/Library/Caches/AndroidStudioPreview

~/Library/Logs/AndroidStudioPreview

~/Library/Preferences/AndroidStudioPreview

查看更多
在下西门庆
4楼-- · 2020-02-20 07:09

I have the same issue just that i cannot change form version 19 to 18. Even though I have both versions installed. I use Android Studio version 0.5.4. One person at the office has the same setup without any problems on the same project. The fix with deleting the folder .AndroidStudioPreview works for one project, but then another I work on breaks.

查看更多
戒情不戒烟
5楼-- · 2020-02-20 07:17

Go to the SDK manager and install Extras -> Android Support Repository

查看更多
Animai°情兽
6楼-- · 2020-02-20 07:18

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\).

查看更多
Lonely孤独者°
7楼-- · 2020-02-20 07:21

Had this problem too in 0.5.3 and the only way I could fix it was to downgrade to 0.5.2.

Even though I added the SDK manually in the project structure window, it would not import android class files properly.

0.5.2 is available here: http://tools.android.com/download/studio/canary/0-5-2

查看更多
登录 后发表回答