Skip to content Skip to sidebar Skip to footer

How To Force Checking For Incompatible Api Usage In Android Code?

I have set minSdk to 7 and targetSdk to 17. I find the problems by manually checking if something crashes. (Yes this is nonsense) I tried setting targetSdk to 7 too. But that doesn

Solution 1:

How can I be sure that I am not using any incompatible code?

Assuming that you are using a reasonably recent version of the Android tools (e.g., something in the past year), Lint will point out to you anything that you are using that is newer than your android:minSdkVersion but is allowed by your build target.

If you are using Eclipse, this should happen automatically when you save source files, or you can manually run Lint on your project by right-clicking over the project in Package Explorer, then choosing Android Tools > Run Lint: Check for Common Errors.

Solution 2:

you check by doing something like this

if(Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1){

}else{

}

Post a Comment for "How To Force Checking For Incompatible Api Usage In Android Code?"