Android studio - Failed to find target android-18

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 task ':AppName:compileDebugAidl'.
> failed to find target android-18

although I have installed the SDK platform of Android 4.3 (API 18) and I tried to reinstall all the SDK. I've also added the ANDROID_HOME variable in the system variables.

What seems to be the source of this error?


Solution 1:

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.

Solution 2:

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.+'
}

Solution 3:

STEP 1) Start Android SDK Manager

With android command something as below,

$ /usr/local/android-studio/sdk/tools/android

STEP 2) Find API 18

enter image description here

STEP 3) Select Android 4.3 (API 18 ) and install packages.