In my case I downloaded version 22 of Android M and Android 5.1.1 using Android Studio 1.2.1.1 but when I try to do a Hello World this same error showed me
So the solution was go to do right click in app like the image below and choose “Open Module Settings”…..
then there you have 2 options. I’ve changed both with the last version I had.
Compile SDK version to API 21 Lollipop
and Build Tools Version to 21.1.2
Finally clean the project and Build
UPDATE
Here is my build.gradle to compare with your build.gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.android.bmi"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
UPDATED
TO Get Android Studio 1.3 follow this steps
- Open the Settings window by choosing File > Settings.
- Choose the Appearance & Behavior > System Settings > Updates panel.
- On the Updates panel, choose the option Automatically check updates for: Canary Chanel.
- On the Updates panel, select Check Now to check for the latest canary build. 5. Download and install the build when you are prompted.
Then you’ll have something like this to update your Android Studio to 1.3 and with this you can test Android M