Android studio - Failed to find target android-18

前端 未结 12 615
陌清茗
陌清茗 2020-11-29 00:22

I have a problem with Android Studio 0.2.3.

When I run my project the build stops and appears message that says:

Gradle: Execution failed for

相关标签:
12条回答
  • 2020-11-29 00:57

    Target with hash string 'android-18' is corresponding to the SDK level 18. You need to install SDK 18 from SDK manager.

    0 讨论(0)
  • 2020-11-29 01:05

    I think you might not have the Android-18 sdk installed. Go to Tools > Android > SDK Manager and check to see if Android 4.3 (API 18) is installed.

    0 讨论(0)
  • 2020-11-29 01:06

    I solved the problem by changing the compileSdkVersion in the Gradle.build file from 18 to 17.

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.5.+'
        }
    }
    apply plugin: 'android'
    
    repositories {
        mavenCentral()
    }
    
    android {
        compileSdkVersion 17
        buildToolsVersion "17.0.0"
    
        defaultConfig {
            minSdkVersion 10
            targetSdkVersion 18
        }
    }
    
    dependencies {
        compile 'com.android.support:support-v4:13.0.+'
    }
    
    0 讨论(0)
  • 2020-11-29 01:06

    I had the same problem when trying out Android Studio. I already had projects running on the ADT under SDK 18. No need to hack the manifest files.

    Fixed by:

    export ANDROID_HOME= pathtobundle/adt-bundle-linux-x86_64-20130729/sdk

    If you don't have the ADT installed, and just want the SDK, it seems like a good solution is to install everything and then point Android Studio to the just the packaged SDK.

    cd pathtobundle

    wget http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130729.zip

    unzip *.zip

    As someone else said, you may need to run the SDK Manager to install the desired packages before running Studio.

    0 讨论(0)
  • 2020-11-29 01:10

    I've had a similar problem occurr when I had both Eclipse, Android Studio and the standalone Android SDK installed (the problem lied where the AVD Manager couldn't find target images). I had been using Eclipse for Android development but have moved over to Android Studio, and quickly found that Android Studio couldn't find my previously created AVDs.

    The problem could potentially lie in that Android Studio is looking at it's own Android SDK (found in C:\Users\username\AppData\Local\Android\android-studio\sdk) and not a previously installed standalone SDK, which I had installed at C:\adt\sdk.

    Renaming Android Studio's SDK folder, in C:\Users... (only rename it, just in case things break) then creating a symbolic link between the Android Studio SDK location and a standalone Android SDK fixes this issue.

    I also used the Link Shell Extension (http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html) just to take the tedium out of creating symbolic links.

    0 讨论(0)
  • 2020-11-29 01:12

    Check the local.properties file in your Studio Project. Chances are that the property sdk.dir points to the wrong folder if you had set/configured a previous android sdk from pre-studio era. This was the solution in my case.

    0 讨论(0)
提交回复
热议问题