Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:29:02+00:00 2026-05-31T20:29:02+00:00

Today I’ve got a stacktrace with a very strange error. Actually, I may be

  • 0

Today I’ve got a stacktrace with a very strange error. Actually, I may be the first person ever to get this (YAY!), since before publishing this question the only occurences of “Bad sparse switch magic” in Google are in the Android source code.

Here’s the part of stacktrace (Android 2.3.4):

java.lang.InternalError: bad sparse switch magic
at org.my.app.MyItemAdapter.(MyItemAdapter.java:64)
at org.my.app.MyActivity.onCreate(MyActivity.java:78)

The error was thrown when exiting from MyItemAdapter constructor. Since it’s internal I’m pretty sure it’s not directly my fault – but I just would like to know, what bad happened inside Dalvik VM.

This error seems to be connected with the switch instruction, just to clarify – I didn’t directly used it in the MyItemAdapter’s constructor. In order to understand what gone wrong I would probably have to carefully study a lot of dalvik-related code, so I’m asking you – maybe there’s somebody who can explain me – what went wrong? I’m just curious.

EDIT

Here’s the piece of Android code which throws that error: http://androidxref.com/source/xref/dalvik/vm/interp/Interp.cpp#1070

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:29:04+00:00Added an answer on May 31, 2026 at 8:29 pm

    There is a sparse-switch dex byte code that is pointing the Android interpreter at an area of memory that is not actually a sparse-switch statement.

    Dex byte code can represent two types of switch statements: packed or sparse. A packed switch statement only has to store the lowest value to switch on. Each subsequent switch value is incremented by one from the previous value, so that the case statements only store a branch target in the byte code. The sparse switch format has an entry for one value and branch target per case statement. See the “sparse-switch-payload” section in the “Bytecode for the Dalvik VM” document (http://source.android.com/tech/dalvik/dalvik-bytecode.html).

    Sparse switch statements in dex are indicated by a noop byte code instruction with a second byte of 0x02 (http://androidxref.com/source/xref/dalvik/libdex/DexOpcodes.h#53). The first byte of a noop instruction is always 0x00, so that the full “magic signature” a sparse switch statement is 0x0200.

    The dex byte code instruction to actually execute a sparse switch statement is called sparse-switch. It’s code is 0x2c, and it also takes a register to test against the switch statement and an address of the switch table. I believe that the address of the switch table in your dex file is incorrect. Without more information, it would be hard to say why.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

today i was facing a strange problem: got a 'missing method' error on a
Today I got into a very interesting conversation with a coworker, of which one
Today is my first day ever messing with PHP or MySQL... I tried to
Today I have faced very strange behavior of sqlite3_finalize statement. I am using sqlite
Today, I ran into this weird problem with a user using Mac OS X.
Today we have received some strange exceptions on our production website. They all have
Today I registered myself on Pinterest.com with my Yahoo account. After registration I got
Today one of our app got rejected due to email button for enquiries and
Today, I got completely surprised when I saw that a global variable has undefined
today i need your help to get an specific sql select query. i have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.