我正在使用 Android Studio,尽管旧项目文件夹中的所有项目都运行良好,但当我尝试创建新项目时,AS 无法识别 AppCompatActivity 类
请查看 build.gradle 和 style 文件夹
请让他们知道如何解决
构建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
targetSdkVersion 23
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:23.0.1'
}
风格:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
更新:之后:com.android.support:appcompat-v7:23.1.1
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.android.support:appcompat-v7:23.1.1.
Required by:
MyApplication4:app:unspecified
> Could not resolve com.android.support:appcompat-v7:23.1.1.
> Could not get resource
'https://jcenter.bintray.com/com/android/support/appcompat-
v7/23.1.1/appcompat-v7-23.1.1.pom'.
> Could not GET
'https://jcenter.bintray.com/com/android/support/appcompat-
v7/23.1.1/appcompat-v7-23.1.1.pom'.
> Connection to https://jcenter.bintray.com refused