gpt4 book ai didi

android - 在 videoView : Android v 4. 2.1 中播放视频时出现 java.lang.StringIndexOutOfBoundsException

转载 作者:IT老高 更新时间:2023-10-28 23:25:56 26 4
gpt4 key购买 nike

当我在 Android 版本 4.2.1 的 videoView 上播放视频时,我遇到了这个崩溃。我专门在 Micromax Canvas A210 设备上发现了这一点。它没有显示发生错误的任何消息。这是应用程序中的错误还是错误?崩溃日志如下:

09-18 11:05:53.245: E/AndroidRuntime(2323): FATAL EXCEPTION: main
09-18 11:05:53.245: E/AndroidRuntime(2323): java.lang.StringIndexOutOfBoundsException: length=11; regionStart=0; regionLength=-1
09-18 11:05:53.245: E/AndroidRuntime(2323): at java.lang.String.startEndAndLength(String.java:583)
09-18 11:05:53.245: E/AndroidRuntime(2323): at java.lang.String.substring(String.java:1464)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.widget.VideoView.openVideo(VideoView.java:407)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.widget.VideoView$6.surfaceCreated(VideoView.java:730)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.SurfaceView.updateWindow(SurfaceView.java:606)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.SurfaceView.access$000(SurfaceView.java:88)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:183)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:692)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2123)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1139)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4879)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.Choreographer.doCallbacks(Choreographer.java:579)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.Choreographer.doFrame(Choreographer.java:548)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.os.Handler.handleCallback(Handler.java:725)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.os.Handler.dispatchMessage(Handler.java:92)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.os.Looper.loop(Looper.java:153)
09-18 11:05:53.245: E/AndroidRuntime(2323): at android.app.ActivityThread.main(ActivityThread.java:5297)
09-18 11:05:53.245: E/AndroidRuntime(2323): at java.lang.reflect.Method.invokeNative(Native Method)
09-18 11:05:53.245: E/AndroidRuntime(2323): at java.lang.reflect.Method.invoke(Method.java:511)
09-18 11:05:53.245: E/AndroidRuntime(2323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
09-18 11:05:53.245: E/AndroidRuntime(2323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
09-18 11:05:53.245: E/AndroidRuntime(2323): at dalvik.system.NativeStart.main(Native Method)

我已经测试过我的应用并且运行良好的其他版本和设备是:

Android versions: 4.1.2, 4.2.2, 4.3, 2.3.3, 4.0.3, 4.0.4
Devices: Samsung Galaxy s2, Samsung Galaxy Tab 2 (7" and 10"), Samsung Galaxy s plus, Sony Xperia Tipo dual, Samsung Galaxy Grand (Quatro and Mega), Nexus 4

最佳答案

您是开发人员并在您的应用程序中使用视频 View 。如果是这样,请尝试调试并验证您是否向视频 View 提供了有效的 uri/url。虽然在 android.widget.VideoView 类的 openVideo() 中有一个空检查,但 uri 可能是空字符串。

Here is the source of the Video View class for the android version you mentioned.

关于android - 在 videoView : Android v 4. 2.1 中播放视频时出现 java.lang.StringIndexOutOfBoundsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18865340/

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