Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native java.lang.NoSuchMethodError: No static method #15

Closed
houyidg opened this issue Nov 30, 2016 · 0 comments
Closed

react-native java.lang.NoSuchMethodError: No static method #15

houyidg opened this issue Nov 30, 2016 · 0 comments
Labels

Comments

@houyidg
Copy link
Contributor

houyidg commented Nov 30, 2016

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.reduxtest-1/base.apk)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1692)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5589)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5184)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5124)
at android.app.ActivityThread.access$1600(ActivityThread.java:179)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1523)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5972)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

解决方案:
之前由于升级了GooglePlay service/Repository 导致进入app还没来得及解析js资源,就直接奔溃。
步骤:
1:查看异常日志检索关键字” java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class” 在stackoverflow找到类似的异常原因是是升级googlepley service库导致《com.google.android.gms:play-services-auth》这个库也跟着升级,从而各个依赖包出现这个问题。因此我就联想昨天晚上因为fb 对于react-native第三方登录sdk集成我对googlpe play service升级过,于是想到降级googlpe play service的方法,或者查找到相应出问题的库进行指定版本降级
2:日志查看到com.google.firebase.FirebaseApp关键字,经过多方查证定位到android-google-firebase-common这个库,然后去github检索此库找到这个库的提交日志将原来的版本9.8.0 直接 定为 9.4.0 问题解决
3:对应androidstudio里gradle配置
有Bug的配置:
compile 'com.google.firebase:firebase-core:9.+'
compile 'com.google.firebase:firebase-messaging:9.+'
解决BUG的配置:
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'

总结:这次这个bug又找了我一天,我们在检索信息的时候,很多结果都是英文需要我们耐心仔细的读懂,答案不一定就是一针见血,但可以找到类似的线索。按着这种思路去尝试的解决。

@houyidg houyidg added the bug label Nov 30, 2016
@houyidg houyidg closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant