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 6078995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:53:47+00:00 2026-05-23T10:53:47+00:00

I’ve come across a backwards compatibility issue when deploying my application on android 1.6.

  • 0

I’ve come across a backwards compatibility issue when deploying my application on android 1.6. Im getting a VerifyError on this piece of code:

if(android.os.Build.VERSION.SDK_INT >= 11) {
    getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
}

This is not unexpected since getActionBar() doesn’t exist pre API 11, however post-1.6 (API 5 and higher?) builds all semi-gracefully go around this according to the logcat message im getting when deploying for example on a API level 8 device;

06-27 16:47:04.333: INFO/dalvikvm(11529): Could not find method com.me.app.MyActivity.getActionBar, referenced from method com.me.app.MyActivity.init
06-27 16:47:04.333: WARN/dalvikvm(11529): VFY: unable to resolve virtual method 1090: Lcom.me.app.MyActivity;.getActionBar ()Landroid/app/ActionBar;
06-27 16:47:04.333: DEBUG/dalvikvm(11529): VFY: replacing opcode 0x6e at 0x004f
06-27 16:47:04.333: DEBUG/dalvikvm(11529): VFY: dead code 0x0052-005f in Lcom.me.app.MyActivity;.init (Z)V

1.6 and earlier wont do this but instead throw a VerifyError:

06-27 16:23:45.561: ERROR/dalvikvm(427): Could not find method com.me.app.MyActivity.getActionBar, referenced from method com.me.app.MyActivity.init
06-27 16:23:45.561: WARN/dalvikvm(427): VFY: unable to resolve virtual method 1090: Lcom/me/app/MyActivity;.getActionBar ()Landroid/app/ActionBar;
06-27 16:23:45.561: WARN/dalvikvm(427): VFY:  rejecting opcode 0x6e at 0x004f
06-27 16:23:45.561: WARN/dalvikvm(427): VFY:  rejected Lcom/me/app/MyActivity;.init (Z)V
06-27 16:23:45.561: WARN/dalvikvm(427): Verifier rejected class Lcom/me/app/MyActivity;
06-27 16:23:45.561: WARN/dalvikvm(427): Class init failed in newInstance call (Lcom/me/app/MyActivity;)
06-27 16:26:44.841: ERROR/AndroidRuntime(427): Uncaught handler: thread main exiting due to uncaught exception
06-27 16:26:44.941: ERROR/AndroidRuntime(427): java.lang.VerifyError: com.me.app.MyActivity
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at java.lang.Class.newInstanceImpl(Native Method)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at java.lang.Class.newInstance(Class.java:1472)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.os.Looper.loop(Looper.java:123)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at android.app.ActivityThread.main(ActivityThread.java:4203)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at java.lang.reflect.Method.invokeNative(Native Method)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at java.lang.reflect.Method.invoke(Method.java:521)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
06-27 16:26:44.941: ERROR/AndroidRuntime(427):     at dalvik.system.NativeStart.main(Native Method)

Is there a way to fix this elegantly and have backwards compatibility to 1.6?

Edit:
So I ended up creating a HoneycombHelper class with static methods:

public class HoneycombHelper {
    public static void setActionBarBackgroundDrawable(Activity a, Drawable d) {
        a.getActionBar().setBackgroundDrawable(d);
    }
    ...
}

Not sure if this is the most elegant way, but it does seem to work.

  • 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-23T10:53:47+00:00Added an answer on May 23, 2026 at 10:53 am

    When Dalvik compiles your class/function from bytecode into native machine code, it compiles all statements, even those that are inside if conditions. On Android 1.6 virtual machine tries to resolve (verify) getActionBar function, and since there is no such function, Dalvik throws VerifyError.

    You can do next trick:

    class ActionBarHelper{
       void setBackground(){
          getActionBar().setBackgroundDrawable(...);
       }
    }
    
    ...
    
    if(android.os.Build.VERSION.SDK_INT >= 11) {
       new ActionBarHelper().setBackground();    
    }
    

    This way ActioBarHelper class will only be compiled/verified when you’re running on SDK 11+. This will in turn allow calling getActionBar function without using reflection (reflection is another possible solution to this problem).

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
Does anyone know how can I replace this 2 symbol below from the string
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

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.