Java – why can’t Android os. build. Version resolves to a variable?

I received an error: "android.os.build.version cannot be resolved to a variable" as attached to the line "int myversion = Android. OS. Build. Version;" The error is in the following 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 I will appreciate the male goose from more experienced eyes

TIA provides any and all help!

to greet,

Steve O'Sullivan

Solution

Because build Version is a static class... Use build VERSION. SDK_ INT

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>