如何解码原始原型字节数组

问题描述

使用10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.view.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:967) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.os.Looper.loop(Looper.java:166) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 10-31 00:39:33.204 32160 32160 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 10-31 10:11:51.383 12826 12826 E AndroidRuntime FATAL EXCEPTION: main 10-31 10:11:51.383 12826 12826 E AndroidRuntime Process: com.mycompany.myapp,PID: 12826 10-31 10:11:51.383 12826 12826 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference 10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:36) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.view.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:967) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.os.Looper.loop(Looper.java:166) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 10-31 10:11:51.383 12826 12826 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 10-31 11:17:37.975 27485 27485 E AndroidRuntime FATAL EXCEPTION: main 10-31 11:17:37.975 27485 27485 E AndroidRuntime Process: com.mycompany.myapp,PID: 27485 10-31 11:17:37.975 27485 27485 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference 10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.view.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:967) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.os.Looper.loop(Looper.java:166) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 10-31 11:17:37.975 27485 27485 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 10-31 11:22:18.006 28004 28004 E AndroidRuntime FATAL EXCEPTION: main 10-31 11:22:18.006 28004 28004 E AndroidRuntime Process: com.mycompany.myapp,PID: 28004 10-31 11:22:18.006 28004 28004 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference 10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.AbsListView.obtainView(AbsListView.java:2428) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.ListView.measureHeightOfChildren(ListView.java:1420) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.ListView.onMeasure(ListView.java:1327) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:451) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6671) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.policy.DecorView.onMeasure(DecorView.java:831) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.View.measure(View.java:22216) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2596) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1638) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1892) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer.doCallbacks(Choreographer.java:790) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer.doFrame(Choreographer.java:721) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.view.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:967) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Handler.handleCallback(Handler.java:808) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:101) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.os.Looper.loop(Looper.java:166) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7529) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 10-31 11:22:18.006 28004 28004 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 10-31 14:21:40.206 12927 12927 I zygote64 Late-enabling -Xcheck:jni 10-31 14:21:40.313 12927 12927 D ActivityThread ActivityThread,attachApplication 10-31 14:21:40.421 12927 12942 I HwApiCachemangerEx apicache mCurPackageName=com.mycompany.myapp uptimes=209549163 10-31 14:21:40.424 12927 12927 D HwFLClassLoader get used feature list :/feature/used-list Failed! 10-31 14:21:40.424 12927 12927 D HwFLClassLoader USE_FEATURE_LIST had not init! 10-31 14:21:40.425 12927 12942 I HwApiCachemangerEx apicache oUid null 10-31 14:21:40.428 12927 12942 I HwApiCachemangerEx apicache volumes null 10-31 14:21:40.456 12927 12942 I HwApiCachemangerEx apicache path=/storage/emulated/0 state=mounted key=com.mycompany.myapp#10773#256 10-31 14:21:40.478 12927 12942 I HwApiCachemangerEx apicache oUid 10773 10-31 14:21:40.478 12927 12942 I HwApiCachemangerEx apicache volumes null 10-31 14:21:40.480 12927 12942 I HwApiCachemangerEx apicache path=/storage/emulated/0 state=mounted key=com.mycompany.myapp#10773#0 10-31 14:21:40.480 12927 12942 I HwApiCachemangerEx apicache async read begin packageName=com.mycompany.myapp userid=0 10-31 14:21:40.480 12927 12942 I HwApiCachemangerEx apicache pi null 10-31 14:21:40.484 12927 12942 I HwApiCachemangerEx apicache pi null 10-31 14:21:40.485 12927 12942 I HwApiCachemangerEx apicache pi null 10-31 14:21:40.486 12927 12942 I HwApiCachemangerEx apicache oUid null 10-31 14:21:40.487 12927 12927 I HwApiCachemangerEx apicache pi null 10-31 14:21:40.488 12927 12942 I HwApiCachemangerEx apicache async read finished packageName=com.mycompany.myapp userid=0 totalus=7115 10-31 14:21:40.492 12927 12942 E MemoryLeakMonitorManager MemoryLeakMonitor.jar is not exist! 10-31 14:21:40.520 12927 12927 I HwCust Constructor found for class android.app.HwCustActivityImpl 10-31 14:21:40.520 12927 12927 D HwCust Create obj success use class android.app.HwCustActivityImpl 10-31 14:21:40.524 12927 12927 V HwPolicyFactory : success to get AllImpl object and return.... 10-31 14:21:40.537 12927 12927 V HwWidgetFactory : successes to get AllImpl object and return.... 10-31 14:21:40.542 12927 12927 V ActivityThread ActivityThread,callActivityOnCreate 10-31 14:21:40.574 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.23,mControlPoint1y = 0.06,mControlPoint2x = 0.09,mControlPoint2y = 0.97 10-31 14:21:40.576 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.6,mControlPoint1y = 0.9,mControlPoint2x = 0.8,mControlPoint2y = 1.0 10-31 14:21:40.577 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.23,mControlPoint2y = 0.97 10-31 14:21:40.578 12927 12927 D CubicBezierInterpolator CubicBezierInterpolator mControlPoint1x = 0.6,mControlPoint2y = 1.0 10-31 14:21:40.611 12927 12927 D HwgalleryCacheManagerImpl mIsEffect:false 10-31 14:21:40.681 12927 12927 D HwWechatOptimizeImpl mIsEffect:false 10-31 14:21:40.733 12927 12927 D HwRTBlurUtils check blur style for HwPhoneWindow,themeResId : 0x7f050000,context : com.mycompany.myapp.MainActivity@a6a9eee,Nhwext : 0,get Blur : disable with,null 10-31 14:21:40.737 12927 12927 W WindowDecorActionBar should not do the transition or the transition anim is null or it is running or the mContainer view is null or mContainer view hasn't been drawn to screen 10-31 14:21:40.739 12927 12927 E HwResourcesImpl readDefaultConfig : FileNotFoundException 10-31 14:21:40.773 12927 12927 I HwCust Constructor found for class android.content.res.HwCustHwResourcesImpl 10-31 14:21:40.773 12927 12927 D HwCust Create obj success use class android.content.res.HwCustHwResourcesImpl 10-31 14:21:40.933 12927 12933 I zygote64 Do partial code cache collection,code=30KB,data=22KB 10-31 14:21:40.934 12927 12933 I zygote64 After code cache collection,data=22KB 10-31 14:21:40.934 12927 12933 I zygote64 Increasing code cache capacity to 128KB 10-31 14:21:40.969 12927 12927 D ActivityThread add activity client record,r= ActivityRecord{380ab03 token=android.os.BinderProxy@2acc333 {com.mycompany.myapp/com.mycompany.myapp.MainActivity}} token= android.os.BinderProxy@2acc333 10-31 14:21:40.984 12927 12927 I HwSecImmHelper mS@R_404_4395@InputMethodService is null 10-31 14:21:40.998 12927 12927 D Openglrenderer hwui Binary is disabled 10-31 14:21:41.080 12927 12965 D Openglrenderer hwui GL Pipeline 10-31 14:21:41.102 12927 12927 I PressGestureDetector onAttached begin 10-31 14:21:41.103 12927 12927 I PressGestureDetector onAttached end 10-31 14:21:41.109 12927 12966 I PressGestureDetector HiTouch restricted: AboardArea. 10-31 14:21:41.157 12927 12965 I Adreno QUALCOMM build : 00d0768,Ie4790512f3 10-31 14:21:41.157 12927 12965 I Adreno Build Date : 06/25/18 10-31 14:21:41.157 12927 12965 I Adreno OpenGL ES Shader Compiler Version: EV031.20.00.04 10-31 14:21:41.157 12927 12965 I Adreno Local Branch : 10-31 14:21:41.157 12927 12965 I Adreno Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.6.5.R1.08.00.00.312.030 10-31 14:21:41.157 12927 12965 I Adreno Remote Branch : NONE 10-31 14:21:41.157 12927 12965 I Adreno Reconstruct Branch : nothing 10-31 14:21:41.167 12927 12965 I Adreno PFP: 0x005ff087,ME: 0x005ff063 10-31 14:21:41.176 12927 12965 I Openglrenderer Initialized EGL,version 1.4 10-31 14:21:41.176 12927 12965 D Openglrenderer Swap behavior 2 10-31 14:21:41.190 12927 12965 E vndksupport Could not load vendor/lib64/egl/libGLES_mali.so from sphal namespace: dlopen Failed: library "vendor/lib64/egl/libGLES_mali.so" not found. 10-31 14:21:41.450 12927 12927 W InputMethodManager startInputReason = 1 10-31 14:21:41.492 12927 12927 W InputMethodManager startInputReason = 5 10-31 14:21:41.805 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:41.805 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:41.819 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:41.819 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:41.832 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:41.832 12927 12927 E SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 10-31 14:21:42.665 12927 12933 I zygote64 Do partial code cache collection,code=61KB,data=49KB 10-31 14:21:42.665 12927 12933 I zygote64 After code cache collection,code=60KB,data=49KB 10-31 14:21:42.665 12927 12933 I zygote64 Increasing code cache capacity to 256KB 10-31 14:21:43.831 12927 12927 W InputMethodManager startInputReason = 3 10-31 14:21:43.900 12927 12927 D AndroidRuntime Shutting down VM 10-31 14:21:43.907 12927 12927 E AndroidRuntime FATAL EXCEPTION: main 10-31 14:21:43.907 12927 12927 E AndroidRuntime Process: com.mycompany.myapp,PID: 12927 10-31 14:21:43.907 12927 12927 E AndroidRuntime java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference 10-31 14:21:43.907 12927 12927 E AndroidRuntime at com.mycompany.myapp.kada.getView(kada.java:38) 可以在它是协议缓冲区的地方获取字节数组数据。如何在不知道类型的情况下使用protobuf-net对其进行解码?该stackoverflow answer在无法实例化HttpClient的最新版本中不再起作用。

解决方法

您仍然可以在v3中实例化阅读器API。唯一的区别是,您应该使用Create而不是new,并且如果可能的话:请使用新的ProtoReader.State API。除此之外,它应该保持大致相同。另外,您不再需要MemoryStream(您可以直接使用诸如byte[]之类的原始缓冲区)。

以下是使用v3和State API的翻译版本:

static void Main()
{
    byte[] arr = // ...
    var reader = ProtoReader.State.Create(arr,null,null);
    try
    {
        WriteTree(ref reader);
    }
    finally
    {   // the rules on when you can "using" a ref-type
        // are ... complicated
        reader.Dispose();
    }
}
static void WriteTree(ref ProtoReader.State reader)
{
    while (reader.ReadFieldHeader() > 0)
    {
        Console.WriteLine(reader.FieldNumber);
        Console.WriteLine(reader.WireType);
        switch (reader.WireType)
        {
            case WireType.Varint:
                // warning: this appear to be wrong if the 
                // value was written signed ("zigzag") - to
                // read zigzag,add: pr.Hint(WireType.SignedVariant);
                Console.WriteLine(reader.ReadInt64());
                break;
            case WireType.String:
                // note: "string" here just means "some bytes"; could
                // be UTF-8,could be a BLOB,could be a "packed array",// or could be sub-object(s); showing UTF-8 for simplicity
                Console.WriteLine(reader.ReadString());
                break;
            case WireType.Fixed32:
                // could be an integer,but probably floating point
                Console.WriteLine(reader.ReadSingle());
                break;
            case WireType.Fixed64:
                // could be an integer,but probably floating point
                Console.WriteLine(reader.ReadDouble());
                break;
            case WireType.StartGroup:
                // one of 2 sub-object formats
                var tok = reader.StartSubItem();
                WriteTree(ref reader);
                reader.EndSubItem(tok);
                break;
            default:
                reader.SkipField();
                break;
        }
    }
}

(非State API仍然可以使用,但这是首选)