gpt4 book ai didi

未找到 Android Theme.AppCompat - 但遵守 Google 说明

转载 作者:行者123 更新时间:2023-11-29 15:12:56 25 4
gpt4 key购买 nike

我正在与 Android 和兼容库 AppCompat 作斗争,但我输了。我来这里哭着寻求帮助。

由于我想使用 NavigationDrawer(使用 Android Studio 自动生成的代码),我必须开始使用 AppCompat 库。我的应用程序不再工作,因为构建器找不到主题 AppCompat。

我遵循了此处的所有步骤:https://developer.android.com/tools/support-library/setup.html#add-library

这是 gradle 文件“Module:app”:

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "19.1"

defaultConfig {
applicationId "it.misc.application"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':another-library-here.')
}

这是 res/values/style.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>

错误是:

Error:Error retrieving parent for item: No resource found 
that matches the given name
'android:Theme.AppCompat.Light.DarkActionBar'.

由于我按照文档所说的进行了所有操作,而且我还按照另一个 StackOverflow 问题的答案中的建议删除/重新安装了兼容性库,所以我不知道还能尝试什么。

会不会和我使用的 API 和构建工具版本有关。 19和Android Support Library 21.0.3? (我认为不是,但是......)


这是新的 gradle,但是构建总是失败:

android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "it.autostradetech.orchestra.negoziante"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':orchestra.autostradetech.it.')
}

如果我将 minSdkVersion 设置为 14、7、8 或任何其他随机数,则没有任何变化。

最佳答案

这不是 android:Theme.AppCompat 只是 Theme.AppCompat。只有来自框架的资源才有前缀。

同时将编译SDK版本改为21,支持库版本、目标SDK和编译SDK版本要对应。

关于未找到 Android Theme.AppCompat - 但遵守 Google 说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28541253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com