1

I am new to android app development. i downloaded and installed android studio. i created a new project. i want to build against minsdkversion 7 (aka android 2.1 aka eclair). i am getting this error from the build system:

Failed to set up SDK
Error:Module 'app': platform 'android-7' not found.
Information:Double-click here to open Android SDK Manager and install all missing platforms.

i have verified that android 7 sdk is indeed installed on my computer at:

C:\Program Files (x86)\Android\android-studio\sdk\platforms\android-7

also:

enter image description here

contents of build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 7
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 7
        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'])
}

Things I have tried:
- re-installing android studio
- if i change compileSdkVersion to 19, it works

how can i fix this please? Has anyone been able to successfully build an android app with compileSdkVersion = 7 using android studio?

morpheus
  • 18,676
  • 24
  • 96
  • 159

2 Answers2

0

As you can see here it seems to be a common bug with Android Studio

The answer says that you should create symbolic links to this files

ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib

If you are in Windows you can search this two files and copy them to your directory, it should work too

Community
  • 1
  • 1
Guillermo Merino
  • 3,197
  • 2
  • 17
  • 34
0

this is a problem with android studio 0.5.3. i downgraded to 0.4.6 and this problem went away. also see Android Studio update 0.5.3 - platform 'android-19' not found.

following notes are just notes regarding a separate issue:

further if you are targetting api level 7, here are some things you might need to do: if you run into this error: No resource found that matches the given name '@android:TextAppearance.Holo.SearchResult.Subtitle'. comment out this code in src\main\res\values\styles.xml:

<style name="AppTheme" parent="Theme.AppCompat">-->
        <!-- Customize your theme here. -->

    </style>-->

comment out this line in build.gradle:
compile 'com.android.support:appcompat-v7:19.+'

if MainActivity is inheriting from ActionBarActivity remove it (ActionBarActivity)

Community
  • 1
  • 1
morpheus
  • 18,676
  • 24
  • 96
  • 159