Why can't android.os.build.VERSION be allowed on a variable?

I am getting the error: "android.os.Build.VERSION cannot be resolved to a variable" as an error associated with the line "int myVersion = android.os.Build.VERSION;" in the below code:

    public void test4_validate_mainOverflowMenuAbout()  {
    int myVersion = android.os.Build.VERSION;
    String myModel = android.os.Build.MODEL;

    if(myVersion >= HONEYCOMB && myModel == "MY PHONE")
        TestUtils.invokeMenuItem(@+id/dashboard_menu_item_about)
        assertTrue(TestUtils.waitForTextOnThePageWithTimeout("My Text", True, 1000));

      

I THINK my control structure is correct, but a gander from more experienced eyes will appreciate.

TIA for any help!

Hello,

Steve O'Sullivan

+3


source to share


2 answers


Since Build.VERSION is a static class ... Use Build.VERSION.SDK_INT



+8


source


In my code, I do this:



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { ... }

      

+4


source







All Articles