简体   繁体   中英

Android App not running on higher version

The app is running fine in Emulator (5.1) and in my phone (4.1.2) , but Its while opening it crashes with "unfortunately App stopped" in bluestacks(4.4.2) and in real phones higher than 4.1

Im getting this below error while running in Bluestacks. Tried changing minsdk version and appcompact options.

    10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.content.Context.getSystemService, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve virtual method 524: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x6f at 0x004b
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.app.Activity.stopLockTask, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve virtual method 279: Landroid/app/Activity;.stopLockTask ()V
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x6f at 0x00b9
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.app.Activity.isInMultiWindowMode, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve virtual method 102: Landroid/app/Activity;.isInMultiWindowMode ()Z
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x6f at 0x00eb
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve check-cast 234 (Landroid/os/PersistableBundle;) in Lcom/androidhive/musicplayer/MusicPlayerMainActivity;
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x1f at 0x00fc
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve virtual method 505: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x6f at 0x010c
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.app.Activity.onVisibleBehindCanceled, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer W/dalvikvm: VFY: unable to resolve virtual method 193: Landroid/app/Activity;.onVisibleBehindCanceled ()V
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer D/dalvikvm: VFY: replacing opcode 0x6f at 0x011c
10-21 22:27:22.551 12147-12147/player.kri.com.saranplayer I/dalvikvm: Could not find method android.content.ContextWrapper.deleteSharedPreferences, referenced from method com.androidhive.musicplayer.MusicPlayerMainActivity.access$super

Really appreciate you help.

this is normal according to google Android engineers.

Refer to https://code.google.com/p/android/issues/detail?id=198567

This happens when you compile against a higher api level than the deployed device api level. The logs are indicating that, some of the methods are not available and the virtual machine is going to replace them with the alternative implementation.

It just means that you have a reference to a method which is not available on that platform where you code currently runs on.

To solve your problem write a runtime switch:

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    // You can use here an API which was added in Lollipop.
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM