How to understand Android version compatible???

Source: Internet
Author: User

Minsdkversion and Targetsdkversion are set up in the program as follows:

<android:minsdkversion= "8"        android:targetsdkversion= "23"  />

The version information for the device is as follows:

Error running the program, log as follows:

01-06 13:56:11.798:e/androidruntime (2396): FATAL exception:main01-06 13:56:11.798:e/androidruntime (2396): java.lang.nosuchmethoderror:android.view.display.getsize01-06 13:56:11.798:e/androidruntime (2396): at     Com.xxx.xxx.activity.TutorialActivity.init (tutorialactivity.java:73) 01-06 13:56:11.798:e/androidruntime (2396): At Com.xxx.xxx.activity.TutorialActivity.onResume (tutorialactivity.java:64) 01-06 13:56:11.798:e/androidruntime ( 2396): At Android.app.Instrumentation.callActivityOnResume (instrumentation.java:1242) 01-06 13:56:11.798:e/ Androidruntime (2396): at Android.app.Activity.performResume (activity.java:4004) 01-06 13:56:11.798:e/ Androidruntime (2396): at Android.app.ActivityThread.performResumeActivity (activitythread.java:2515) 01-06 13:56:11.798:e/androidruntime (2396): at Android.app.ActivityThread.handleResumeActivity (activitythread.java:2546 ) 01-06 13:56:11.798:e/androidruntime (2396): at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java:1859) 01-06 13:56:11.798:e/androidruntime (2396): at android.app.activitythread.access$1500 ( activitythread.java:135) 01-06 13:56:11.798:e/androidruntime (2396): at Android.app.activitythread$h.handlemessage ( activitythread.java:1041) 01-06 13:56:11.798:e/androidruntime (2396): at Android.os.Handler.dispatchMessage ( handler.java:99) 01-06 13:56:11.798:e/androidruntime (2396): at Android.os.Looper.loop (looper.java:150) 01-06 13:56:11.798:e/androidruntime (2396): at Android.app.ActivityThread.main (activitythread.java:4333) 01-06 13:56:11.798:e/androidruntime (2396): at Java.lang.reflect.Method.invokeNative (Native Method) 01-06 13:56:11.798:e/ Androidruntime (2396): at Java.lang.reflect.Method.invoke (method.java:507) 01-06 13:56:11.798:e/androidruntime (2396 ): At Com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:849) 01-06 13:56:11.798:e/ Androidruntime (2396): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:607) 01-06 13:56:11.798:e/androidruntime (2396): at Dalvik.system.NativeStart.main (Native Method) 

Check the official documentation to learn:

The method is added in Android 3.2, the question comes up, what do you let 3.2 users do? When writing the code, the IDE has no hint that this method will not work.

For this version of Android compatibility issues really do not want to vomit groove, the final solution is to solve the problem is:

if (Build.VERSION.SDK_INT >= build.version_codes. HONEYCOMB_MR2) {     //  code block containing the new API else  {     //  code block containing the old API }

The eggs were broken in one place.

How to understand Android version compatible???

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.