Note that there are some explanatory texts on larger screens.

plurals
  1. POApp can't start on Android 2.3
    primarykey
    data
    text
    <p>My app doesn't want to start on Android 2.3 even though I made it for minimum 2.2, here is the LogCat. I tested in on both the emulator and on a device with 2.3 Android, it doesn't run at all, but on my other device with 4.0 it run's just fine... What could be wrong?</p> <pre><code>04-16 13:18:40.982: D/dalvikvm(6191): GC_CONCURRENT freed 41K, 49% free 2761K/5379K, external 3443K/4300K, paused 3ms+42ms 04-16 13:18:41.652: D/dalvikvm(6191): GC_CONCURRENT freed 1K, 49% free 2761K/5379K, external 4643K/4643K, paused 2ms+10ms 04-16 13:18:41.942: D/AndroidRuntime(6191): Shutting down VM 04-16 13:18:41.942: W/dalvikvm(6191): threadid=1: thread exiting with uncaught exception (group=0x2aac8578) 04-16 13:18:41.952: E/AndroidRuntime(6191): FATAL EXCEPTION: main 04-16 13:18:41.952: E/AndroidRuntime(6191): java.lang.RuntimeException: Unable to resume activity {spec.sartheris.myapp/spec.sartheris.myapp.MainActivity}: java.lang.NullPointerException 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2141) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2156) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1680) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.access$1500(ActivityThread.java:121) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.os.Handler.dispatchMessage(Handler.java:99) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.os.Looper.loop(Looper.java:130) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.main(ActivityThread.java:3701) 04-16 13:18:41.952: E/AndroidRuntime(6191): at java.lang.reflect.Method.invokeNative(Native Method) 04-16 13:18:41.952: E/AndroidRuntime(6191): at java.lang.reflect.Method.invoke(Method.java:507) 04-16 13:18:41.952: E/AndroidRuntime(6191): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 04-16 13:18:41.952: E/AndroidRuntime(6191): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624) 04-16 13:18:41.952: E/AndroidRuntime(6191): at dalvik.system.NativeStart.main(Native Method) 04-16 13:18:41.952: E/AndroidRuntime(6191): Caused by: java.lang.NullPointerException 04-16 13:18:41.952: E/AndroidRuntime(6191): at spec.sartheris.myapp.MainActivity.onResume(MainActivity.java:47) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.Activity.performResume(Activity.java:3832) 04-16 13:18:41.952: E/AndroidRuntime(6191): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2131) 04-16 13:18:41.952: E/AndroidRuntime(6191): ... 12 more 04-16 13:18:42.002: D/dalvikvm(6191): GC_CONCURRENT freed 54K, 49% free 2775K/5379K, external 2543K/5243K, paused 2ms+13ms </code></pre> <p>here is the code in MainActivity</p> <pre><code>public class MainActivity extends Activity { MediaPlayer music; int length; ImageView img; AnimationDrawable animation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); music = MediaPlayer.create(getApplicationContext(), R.raw.mymusic); music.setLooping(true); music.start(); img = (ImageView) findViewById(R.id.imageView1); img.setBackgroundResource(R.drawable.myanim); animation = (AnimationDrawable) img.getDrawable(); animation.start(); } @Override protected void onPause() { super.onPause(); music.pause(); length = music.getCurrentPosition(); } @Override protected void onResume() { super.onResume(); music.seekTo(length); music.start(); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.options, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about: Intent ia = new Intent("spec.sartheris.myapp.ABOUTUS"); startActivity(ia); break; case R.id.exit: finish(); break; } return false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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