I installed Android Studio 2.1.3, and successfully created a new project (just call it ProA), it runs well in AVD. That time I had just only downloaded the SDK platform android-24. I created that project with the Minimum SDK API 14. Actually , I didn't download android-14 at that time.
Then later I downloaded android-14, android-15,android-21,android-23, tried to create a new project (call it ProB), but many errors occurred there.
The
MainActivity
's superclass isAppCompatActivity
, but the error isCannot solve symbol 'AppCompatActivity'
.There is a red line under the
@Override
tag over theonCreate()
method, saying thatMethod does not override a method from its superclass
In
onCreate()
method ,thesetContentView(R.layout.activity_main)
code snippet showsCannot resolve symbol 'R'
.- The Messages window has a error message saying
A problem occurred configuring project ':app'.
Could not download support-compat.aar(com.android.support:-compat:24.2.0): No cached version available for offline mode
the overall picture is like this: the overall error image(click to see)
the content of app\src\build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.example.zhangsir.aftervpn"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
}
the content of gradle\build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
the screenshot of the standalone sdk manager (click to see)
modified at 2016 Aug,27
I have downloaded all the Android SDK Build-tools:
What can I do to solve this problem?