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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:28:20+00:00 2026-05-26T08:28:20+00:00

PREAMBLE: this question is quite obsolete, it was written when the preferred Android dev

  • 0

PREAMBLE: this question is quite obsolete, it was written when the preferred Android dev environment was Eclipse with the Android plugin.


I had a Java Android project for a while. Today, I’ve updated the Android dev tools to the Google’s latest. And the project broke – I get a bunch of "case expressions must be constant expressions" compilation error messages.

Turns out that the R.java file is being now generated differently. Formerly, it would have a bunch of

public static final int MyID=0x12340000;

statements; now, it looks (after a clean/rebuild) like this:

public static int MyID=0x12340000;

final is gone. So all switches on resource IDs that I had (and I had a few) are wrong. What happened, please? Is it just me? What’s the rationale here? Is it documented anywhere? Can I bring final back somehow?

  • 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-26T08:28:21+00:00Added an answer on May 26, 2026 at 8:28 am

    This happened about yesterday, when the SDK/ADT 14 got released:

    As of ADT 14, resource constants in library projects are no longer
    final. This is explained in greater detail in http://tools.android.com/tips/non-constant-fields

    There’s a quickfix available from ADT 14: http://tools.android.com/recent/switchstatementconversion

    To quote from the rationale:

    When multiple library projects are combined, the actual values of the
    fields (which must be unique) could collide. Before ADT 14, all fields
    were final, so as a result, all libraries had to have all their
    resources and associated Java code recompiled along with the main
    project whenever they were used. This was bad for performance, since
    it made builds very slow. It also prevented distributing library
    projects that didn’t include the source code, limiting the usage scope
    of library projects.

    The reason the fields are no longer final is that it means that the library jars can be compiled once and reused directly in other projects. As well as allowing distributing binary version of library projects (coming in r15), this makes for much faster builds.

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

Sidebar

Related Questions

Preamble So, this question has already been answered, but as it was my first
Preamble I've searched to see if I can find this question anywhere on here
Preamble I'm asking this question because even though I've read through a lot of
Preamble: This is very close to this question , and I have read this
Colleagues, Preamble. My question is more about best practices. I know one workaround. This
Preamble: My core question is very similar to this one: How can I write
PREAMBLE: the question is wildly obsolete. There's no more Google Checkout, no more Checkout
Small preamble. I was good java developer on 1.4 jdk. After it I have
Sorry for long description, however the questions aren't so easy... My project written without
[Preamble: Whereas I realize there may be simpler ways to do this (i.e., just

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.