正如问题所述,我正在使用SDK 23编译,目标是SDK 23,并使用min SDK版本19。当使用API级别20/21/22/23中的任何组件时,Android /Eclipse应该会显示一个lint错误,但是对于API级别23则不然。
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
public class MyActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Incorrect cast for a system service, correctly caught by lint
WifiManager wifiManager = (WifiManager) getSystemService(Context.ALARM_SERVICE);
Fragment fragment = new Fragment();
fragment.isDetached(); //API level 13 (correct, no warning)
fragment.setMenuVisibility(true); //API level 14 (correct, no warning)
finishAndRemoveTask(); //API level 21 (correct, warning)
getMediaController(); //API level 21 (correct, warning)
getReferrer(); //API level 22 (correct, warning)
getSearchEvent(); //API level 23 (INCORRECT: no warning)
showLockTaskEscapeMessage(); //API level 23 (INCORRECT: no warning)
}
}我使用diff/23/changes.html来选择几种方法进行测试。
我没有立即在谷歌或http://developer.android.com/tools/help/lint.html,http://tools.android.com/tips/lint-checks上看到任何有关这方面的信息。
发布于 2015-08-31 06:27:47
不过,我在AOSP问题跟踪器上发现了一个悬而未决的问题,看上去就像平台一样--23/android.jar没有包含在apigenerator脚本中。谷歌正在努力解决这个问题。
https://stackoverflow.com/questions/32305039
复制相似问题