1
votes

In some case, I found the android studio lint does not show the message “Call requires API level xxx (current min is xxx)”.

public class TestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_enter_leave_wifi);
    if(isDestroyed()){

    }
}

private class Test {
    Test(){
        if (isDestroyed()){

        }
    }
}

I found there is the error message in the isDestroyed() in the onCreate, but there is no such error tips in the constructor of Test

enter image description here

How to solve this issue?

UPDATE:

Current minSdkVersion is 14. That's why the isDestroyed(), which requires 17, in onCreate gives the error tip

1
What is your Min. API target? - Sean83
that code is never called. therefore, the problem will never happen. -> try to instanciate Test to see if it changes the analyse. - njzk2
I tried to create a new instance of Test, but still it doesn't show the error tip - mianlaoshu

1 Answers

0
votes

The functionality you want to perform requires higher API level access than your current minimum in which that functionality/access is not available.

In order to achieve that, simply change the API level of current minimum to the required one in app:gradle file. And then recompile the project.

Good Luck