gpt4 book ai didi

android - 无法在 21 以下的 Api 中获取提供商 com.google.firebase.provider.FirebaseInitProvider

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:42:25 24 4
gpt4 key购买 nike

我在 API 18 中遇到问题,它在 API 21 及更高版本中有效。

在 Pre Lollipop 版本的设备中出现错误,它在 API 21 及更高版本中成功运行应用程序:

 E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: String resource ID #0x7f070150
at android.app.ActivityThread.installProvider(ActivityThread.java:4882)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f070150
at android.content.res.Resources.getText(Resources.java:239)
at android.content.res.Resources.getString(Resources.java:325)
at com.google.android.gms.common.internal.zzai.getString(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.zzeh(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1214)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1189)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4879)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4485) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425) 
at android.app.ActivityThread.access$1300(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:5103) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
at dalvik.system.NativeStart.main(Native Method) 

需要帮助..:-(

提前致谢。

我尝试在下面的链接中搜索,但没有得到结果。 Unable to get provider com.google.firebase.provider.FirebaseInitProvider

等待某人的帮助:-(

Gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'

compileOptions.encoding = 'windows-1251'
compileOptions.encoding = 'ISO-8859-1'

defaultConfig {
applicationId "com.ascovalve.calculators"
minSdkVersion 14
targetSdkVersion 22
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}

packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/values-v21'] } }
dexOptions {

preDexLibraries = false
incremental = true;
javaMaxHeapSize "4g"
}
useLibrary 'org.apache.http.legacy'
}

configurations {
all*.exclude group: 'com.google.firebase', module: 'firebase-common'
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.2.3'
compile 'com.android.support:support-v4:+'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'


compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:+'
compile 'com.android.support:multidex:1.0.1'
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex'
dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
}
}

apply plugin: 'com.google.gms.google-services'

最佳答案

我有一个类似的错误,并通过从另一个 Android 应用程序的反编译中删除剩余的 R.java 文件来解决它。 (是的,反编译是合乎道德的!)

其他 Android 应用程序也在使用 google-play-services 作为库,因此它的 R.java 文件覆盖了我自己应用程序资源中的 R.java,使运行时使用的资源 ID 无效,从而导致firebase 尝试使用 google-play-services 时出错。

关于android - 无法在 21 以下的 Api 中获取提供商 com.google.firebase.provider.FirebaseInitProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38526118/

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