Note that there are some explanatory texts on larger screens.

plurals
  1. POsame app, works on 2.2 up to 3.3 Android version but doesn't work on Android 4.0 and above
    text
    copied!<p>I'm testing a simple app, that use VideoView to play an http/rtsp video from internet. The app works fine into 2.2 versions up to 3.3, but when i test it on 4.0 and higher, crash!!! (tested both, on the emulator and real mobile :-/)</p> <p>Can anyone give me a hint why?</p> <p>xml file:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;EditText android:id="@+id/path" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;VideoView android:id="@+id/surface_view" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/VideoView&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" &gt; &lt;ImageButton android:id="@+id/play" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/play"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>java file:</p> <pre><code> public class Video extends Activity { private static final String TAG = "VideoViewDemo"; private VideoView mVideoView; private EditText mPath; private ImageButton mPlay; private Uri current; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.video); mVideoView = (VideoView) findViewById(R.id.surface_view); mPath = (EditText) findViewById(R.id.path); mPath.setText("http://daily3gp.com/vids/747.3gp"); playVideo(); mPlay = (ImageButton) findViewById(R.id.play); mPlay.setOnClickListener(new OnClickListener() { public void onClick(View view) { playVideo(); } }); runOnUiThread(new Runnable(){ public void run() { playVideo(); } }); } private void playVideo() { try { //final String path = mPath.getText().toString(); Uri path = Uri.parse(mPath.getText().toString()); Log.v(TAG, "path: " + path); if (path == null) { Toast.makeText(Video.this, "File URL/path is empty", Toast.LENGTH_LONG).show(); } else { // If the path has not changed, just start the media player if (path.equals(current) &amp;&amp; mVideoView != null) { mVideoView.start(); mVideoView.requestFocus(); return; } current = path; mVideoView.setVideoURI(path); mVideoView.start(); mVideoView.requestFocus(); } } catch (Exception e) { Log.e(TAG, "error: " + e.getMessage(), e); if (mVideoView != null) { mVideoView.stopPlayback(); } } } } </code></pre> <p>here the Logcat file with the erros:</p> <pre><code> 11-09 17:25:32.582: E/WindowManager(538): Activity com.testing.interacciones.Video has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@413fb820 that was originally added here 11-09 17:25:32.582: E/WindowManager(538): android.view.WindowLeaked: Activity com.testing.interacciones.Video has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@413fb820 that was originally added here 11-09 17:25:32.582: E/WindowManager(538): at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:343) 11-09 17:25:32.582: E/WindowManager(538): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:245) 11-09 17:25:32.582: E/WindowManager(538): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193) 11-09 17:25:32.582: E/WindowManager(538): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118) 11-09 17:25:32.582: E/WindowManager(538): at android.view.Window$LocalWindowManager.addView(Window.java:537) 11-09 17:25:32.582: E/WindowManager(538): at android.app.Dialog.show(Dialog.java:274) 11-09 17:25:32.582: E/WindowManager(538): at android.app.AlertDialog$Builder.show(AlertDialog.java:932) 11-09 17:25:32.582: E/WindowManager(538): at android.widget.VideoView$4.onError(VideoView.java:382) 11-09 17:25:32.582: E/WindowManager(538): at android.widget.VideoView.openVideo(VideoView.java:240) 11-09 17:25:32.582: E/WindowManager(538): at android.widget.VideoView.access$2000(VideoView.java:49) 11-09 17:25:32.582: E/WindowManager(538): at android.widget.VideoView$6.surfaceCreated(VideoView.java:465) 11-09 17:25:32.582: E/WindowManager(538): at android.view.SurfaceView.updateWindow(SurfaceView.java:562) 11-09 17:25:32.582: E/WindowManager(538): at android.view.SurfaceView.access$000(SurfaceView.java:82) 11-09 17:25:32.582: E/WindowManager(538): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:171) 11-09 17:25:32.582: E/WindowManager(538): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590) 11-09 17:25:32.582: E/WindowManager(538): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1596) 11-09 17:25:32.582: E/WindowManager(538): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418) 11-09 17:25:32.582: E/WindowManager(538): at android.os.Handler.dispatchMessage(Handler.java:99) 11-09 17:25:32.582: E/WindowManager(538): at android.os.Looper.loop(Looper.java:137) 11-09 17:25:32.582: E/WindowManager(538): at android.app.ActivityThread.main(ActivityThread.java:4340) 11-09 17:25:32.582: E/WindowManager(538): at java.lang.reflect.Method.invokeNative(Native Method) 11-09 17:25:32.582: E/WindowManager(538): at java.lang.reflect.Method.invoke(Method.java:511) 11-09 17:25:32.582: E/WindowManager(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 11-09 17:25:32.582: E/WindowManager(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 11-09 17:25:32.582: E/WindowManager(538): at dalvik.system.NativeStart.main(Native Method) 11-09 17:25:38.494: D/ExchangeService(421): Received deviceId from Email app: androidc259148960 11-09 17:25:38.494: D/ExchangeService(421): Reconciling accounts... 11-09 17:25:40.621: W/ThrottleService(93): unable to find stats for iface rmnet0 11-09 17:28:46.553: D/dalvikvm(177): GC_CONCURRENT freed 458K, 6% free 10347K/10951K, paused 7ms+8ms 11-09 17:28:48.562: I/dalvikvm(93): Jit: resizing JitTable from 4096 to 8192 11-09 17:30:29.982: I/Process(538): Sending signal. PID: 538 SIG: 9 11-09 17:30:30.122: I/ActivityManager(93): Process com.testing.interacciones (pid 538) has died. 11-09 17:30:30.132: W/InputDispatcher(93): channel '41650408 com.testing.interacciones/com.testing.interacciones.Splash (server)' ~ Consumer closed input channel or an error occurred. events=0x8 11-09 17:30:30.132: E/InputDispatcher(93): channel '41650408 com.testing.interacciones/com.testing.interacciones.Splash (server)' ~ Channel is unrecoverably broken and will be disposed! </code></pre> <p>my manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.testing.interacciones" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="3" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".Splash" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".Video" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>The crash error on the mobile just say "Unfortunately, Test VideoView has stopped"</p> <p>Thx in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload