0

on developing an android app with webservices. which uses :

     <uses-sdk android:minSdkVersion="8"
         android:targetSdkVersion="8" />

I am facing problem while importing import android.os.StrictMode; (it cannot be resolved) my code is giving me an exception "java.net.SocketException: Permission denied for android" because of this.if the strictmode is not supported in api 8 . what is the alternative for it?

TNR
  • 5,839
  • 3
  • 33
  • 62
Ashi
  • 207
  • 5
  • 12

3 Answers3

3

Hey StrictMode Class was introduced in API Level 9 and your project target is API Level 8. Please Refer this link. So You are getting the error.

TNR
  • 5,839
  • 3
  • 33
  • 62
1

Go to the AndroidManifest.xml file

In your File the minSdkVersion is 8

<uses-sdk android:minSdkVersion="8" />

Change The SDK version to 9 like shown below

<uses-sdk android:minSdkVersion="9" />

it will solve your problem.

And see below link for more information about StrictMode.

Android - StrictMode

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
0

If you still want to go with API Level 8.

Check this link :

Android StrictMode for all platform versions

Thanks.

Pratik Sharma
  • 13,307
  • 5
  • 27
  • 37