0

我有一个反应本机应用程序,我在第一页使用社交登录按钮,即在登录页面,当我在大于 4 的 android 版本中运行我的应用程序时,如果 android 版本小于 4 应用程序在启动时崩溃,它可以工作,我已经在 OS 版本中进行了测试:4.4.2、4.4.4 和 4.3 它在上述所有版本中都崩溃了。我的登录按钮代码片段。

<LoginButton
                        publishPermissions={["publish_actions"]}
                        onLoginFinished={
                        (error, result) => {
                        if (error) {
                        alert("login failed");
                        alert("login has error: " + result.error);
                        } else if (result.isCancelled) {
                        alert("login is cancelled.");
                        } else {
                         alert("success");
                         }
                         )
                        }
                        }
                        }
/>

我正在使用的版本 "react-native-fbsdk": "^0.4.0", react-native --version
react-native-cli: 2.0.1 react-native: 0.38.0

crashlytics 的崩溃报告是

#0. Crashed: main: 0 0 0x0000000000000000
       at android.content.res.Resources.loadDrawable(Resources.java:2136)
       at android.content.res.Resources.getDrawable(Resources.java:715)
       at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
       at com.facebook.login.widget.LoginButton.configureButton(LoginButton.java:586)
       at com.facebook.FacebookButtonBase.<init>(FacebookButtonBase.java:64)
       at com.facebook.login.widget.LoginButton.<init>(LoginButton.java:195)
       at com.facebook.reactnative.androidsdk.RCTLoginButton.<init>(RCTLoginButton.java:50)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:56)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:37)
       at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:46)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:218)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:890)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:863)
       at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
       at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
       at android.view.Choreographer.doCallbacks(Choreographer.java:574)
       at android.view.Choreographer.doFrame(Choreographer.java:543)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5118)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
       at dalvik.system.NativeStart.main(NativeStart.java)

--

Fatal Exception: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
       at android.content.res.Resources.loadDrawable(Resources.java:2136)
       at android.content.res.Resources.getDrawable(Resources.java:715)
       at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
       at com.facebook.login.widget.LoginButton.configureButton(LoginButton.java:586)
       at com.facebook.FacebookButtonBase.<init>(FacebookButtonBase.java:64)
       at com.facebook.login.widget.LoginButton.<init>(LoginButton.java:195)
       at com.facebook.reactnative.androidsdk.RCTLoginButton.<init>(RCTLoginButton.java:50)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:56)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:37)
       at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:46)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:218)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:890)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:863)
       at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
       at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
       at android.view.Choreographer.doCallbacks(Choreographer.java:574)
       at android.view.Choreographer.doFrame(Choreographer.java:543)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5118)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
       at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
       at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
       at android.content.res.Resources.loadDrawable(Resources.java:2132)
       at android.content.res.Resources.getDrawable(Resources.java:715)
       at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
       at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
       at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
       at com.facebook.login.widget.LoginButton.configureButton(LoginButton.java:586)
       at com.facebook.FacebookButtonBase.<init>(FacebookButtonBase.java:64)
       at com.facebook.login.widget.LoginButton.<init>(LoginButton.java:195)
       at com.facebook.reactnative.androidsdk.RCTLoginButton.<init>(RCTLoginButton.java:50)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:56)
       at com.facebook.reactnative.androidsdk.FBLoginButtonManager.createViewInstance(FBLoginButtonManager.java:37)
       at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:46)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:218)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:890)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:863)
       at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
       at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:759)
       at android.view.Choreographer.doCallbacks(Choreographer.java:574)
       at android.view.Choreographer.doFrame(Choreographer.java:543)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5118)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
       at dalvik.system.NativeStart.main(NativeStart.java)
4

1 回答 1

0

React Native 支持的最低版本是 Android 4.1 (API 16)

更多细节在这里 - https://github.com/facebook/react-native#react-native---

于 2017-03-08T07:34:09.997 回答