IntelliJ/Android -> "java: constant expression required" on case R.id.viewId
android, intellij-idea, java
Solution
Resource ids are not constants in a library project since ADT version 14, so you can't use them in switch statement. Just use `if () {} else if () {} ...` instead.
You can find more detailed information here.
Problem
When I try to build my Android project in IntelliJ i get error´s on every switch statement which cases use Id´s out of the R.java. Example: ``` switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpTo(this, DashboardActivity.upIntent(this)); return true; case R.id.orders_options_add: handleAddItem(); return true; case R.id.orders_options_reorder: handleReorder(); finish(); return true; } ``` Does anyone know how to solve this problem?