Android - Call Requires Api Level 9 (current Min Is 8): Android.os.strictmode#setthreadpolicy
I am new to JSON. I followed this tutorial to create sample app. When i try to copy the code to my eclipse it show error. Call requires API level 9 (current min is 8): android.os.
Solution 1:
Go to the android AndroidManifest.xml
In your File it is 8
<uses-sdkandroid:minSdkVersion="8" />
Change The SDK version to 9 like shown below
<uses-sdkandroid:minSdkVersion="9" />
Solution 2:
Right Click on you Android Project>Android Tools>Clear Lint Markers
"Run Android Lint" makes some markers and the markers cause this error.
This worked for me so if you use this don't need to change the
<uses-sdkandroid:minSdkVersion="8" />
to 9
Solution 3:
In AndroidManifest.xml you have defined minSdkVersion as 8
<uses-sdkandroid:minSdkVersion="8" />
Though in the you code you are using StrictMode which is supported fromA API level 9.
So either you can skip using StrictMode in your app or set midSdkVersion as 9.
To skip using StrictMode just remove these lines.
import android.os.StrictMode;
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
Solution 4:
Other answers are correct, but if you still see the error be sure to "Sync Project with Gradle Files" (on Android Studio toolbar).
Post a Comment for "Android - Call Requires Api Level 9 (current Min Is 8): Android.os.strictmode#setthreadpolicy"