android - 当我更改 sdk 版本时,我遇到 Theme.Dialog 错误
问题描述
我正在尝试为我的 android 应用安装 Firebase Crashlytics。所有版本的 Firebase Crashlytics 都接受 16 作为最低 SDK。minSdkVersion
我的应用程序中有 14 个可用。当我提高minSdkVersion
到 16 时,我收到以下错误
C:\Users\Emircan\Desktop\mlxpos\app\src\main\res\values\styles.xml:2:5-5:13: AAPT: error: resource android:style/android:Theme.Dialog not found。
错误行:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="editTextColor">@color/black</item>
<item name="android:dialogTheme">@android:style/android:Theme.Dialog</item>
</style>
如果我设置minSdkVersion
14,我会收到以下错误。
清单合并失败:uses-sdk:minSdkVersion 14 不能小于库 [com.google.firebase:firebase-analytics:17.6.0] C:\Users\Emircan.gradle\caches\transforms-2\files 中声明的版本 16 -2.1\cfbe933ef2af918ca181d266a71288ac\firebase-analytics-17.6.0\AndroidManifest.xml 因为该库可能正在使用 14 中不可用的 API 建议:使用 minSdk 最多为 14 的兼容库,或将此项目的 minSdk 版本增加到至少16、或者使用tools:overrideLibrary="com.google.firebase.firebase_analytics" 强制使用(可能导致运行时失败)
我怎样才能解决这个问题 ?(crashlytics 的最低版本是 17.0.0,它也不接受它。)
这是 build.gradle(:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
aaptOptions {
cruncherEnabled = false
}
dexOptions {
jumboMode true
}
compileSdkVersion 28
compileOptions.encoding = 'windows-1254'
lintOptions {
checkReleaseBuilds false
}
defaultConfig {
applicationId "com.crash.app"
minSdkVersion 14
targetSdkVersion 28
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
/* Do not compile these resources in debug mode. Faster build time.
ext.enableCrashlytics = false
crunchPngs false */
minifyEnabled false
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
productFlavors {
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation "com.github.YarikSOffice:lingver:1.3.0"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.code.gson:gson:2.7'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation files('libs/AndroidEasingFunctions-1.0.0.jar')
implementation files('libs/AndroidViewAnimations-1.1.2.jar')
implementation files('libs/NineOldAndroid-2.4.0.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/acra-4.7.0.jar')
implementation files('libs/apache-mime4j-core-0.7.2.jar')
implementation files('libs/httpclient-4.3.6.jar')
implementation files('libs/httpcore-4.4.3.jar')
implementation files('libs/httpmime-4.3.6.jar')
implementation files('libs/jsoup-1.10.1.jar')
implementation files('libs/logback-android-1.1.1-4.jar')
implementation files('libs/mpandroidchartlibrary-2-1-3.jar')
implementation files('libs/slf4j-api-1.7.6.jar')
implementation files('libs/d2xx.jar')
// Gprinter library
implementation files('libs/commons-lang-2.6.jar')
implementation files('libs/gprintersdkv2.1.3.jar')
implementation files('libs/jcc-bate-0.7.3.jar')
// Gprinter library finish
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.github.clans:fab:1.6.4'
implementation 'androidx.multidex:multidex:2.0.0'
implementation(name: 'callerlibrary', ext: 'aar')
implementation(name: 'numbertowordsconverter', ext: 'aar')
// compile 'me.dm7.barcodescanner:zxing:1.9.8'
// implementation 'junit:junit:4.13-beta-2'
// implementation 'com.squareup.leakcanary:leakcanary-android:2.1'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.6.0'
}
解决方案
好吧,如果你想使用Firebase Crashlytics
你必须将最小sdk版本升级到至少16。
你在最小sdk设置为16时遇到的问题是由于新版本中不存在的错误主题(Theme.Dialog) . 改成Theme.AppCompat.Dialog
应该没问题的。
推荐阅读
- java - 将 android {} 块放入 kotlin dsl build.gradle.kts 的项目扩展中
- javascript - 有没有办法让我网站的所有外部链接出现在反应的新标签中?
- django - 如何在 django 的单个字段上从多个模型创建外键
- python - 在 tkinter 中将变量从 GUI 写入文本文件
- r - 错误:尝试运行 vuong() 函数时,未为此 S4 类定义 $ 运算符
- git - 如何创建一个 cron 作业,该作业将在每个星期五提交我的存储库中的所有更改
- python - 绘制底图时Python“EPSG代码未知”?
- c - 哪些隐式声明是允许/有效的?
- python - 熊猫 - 从函数中排除第一行和最后一行 - 日期时间
- reactjs - 如何更改 gatsby 站点地图的 url?