gpt4 book ai didi

android - 致命异常 : java. lang.NoSuchMethodError: 没有静态方法 isDeviceProtectedStorage

转载 作者:太空狗 更新时间:2023-10-29 15:25:29 24 4
gpt4 key购买 nike

使用 cordova-plugin-firebase 时,我遇到了以下错误:

04-27 16:59:35.745  6859  6859 E AndroidRuntime: FATAL EXCEPTION: main
04-27 16:59:35.745 6859 6859 E AndroidRuntime: Process: com.XXXXXXXXXX.XXXXXXXXXXX, PID: 6859
04-27 16:59:35.745 6859 6859 E AndroidRuntime: java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.XXXXXXXXXX.XXXXXXXXXXX-1/base.apk)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.FirebaseApp.zza(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:5855)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:5447)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5386)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread.-wrap2(ActivityThread.java)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6121)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
04-27 16:59:35.745 6859 6859 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
04-27 16:59:35.749 975 1021 W ActivityManager: Force finishing activity com.XXXXXXXXXX.XXXXXXXXXXX/.MainActivity
04-27 16:59:35.779 2358 6582 I PBSessionCacheImpl: Deleted sessionId[10372086956677829] from persistence.
04-27 16:59:35.795 2358 2358 W SearchService: Abort, client detached.
04-27 16:59:35.798 2358 2358 E WorkerRegistryImpl: getWorker() is called after WorkerRegistry disposal.
04-27 16:59:35.798 2358 2358 E WorkerRegistryImpl: getWorker() is called after WorkerRegistry disposal.

一开始我以为是因为isDeviceProtectedStorage在 android.support.v4.content.ContextCompat 中仅在 API 24 及更高版本中添加。但即使使用搭载 Android 7 的较新设备,也会出现相同的消息。

为什么找不到方法?是因为我没有安装一些库吗?

最佳答案

根据 Android 开发人员文档,isDeviceProtectedStorage 是在 24.0.0 中添加的。如果您运行的应用程序低于上述 API 版本,请检查它

if (Build.VERSION.SDK_INT >= 24){
//TODO: Do your stuff here.
}

https://developer.android.com/reference/android/support/v4/content/ContextCompat.html#isDeviceProtectedStorage(android.content.Context)

关于android - 致命异常 : java. lang.NoSuchMethodError: 没有静态方法 isDeviceProtectedStorage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43653431/

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