My program is working absolutely fine from android 2.1 to android 2.3
But its not working on higher version of android
I have used in my manifest file
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="10"
android:maxSdkVersion="15"/>
Logcat output error while running the project on android 4.0.3 avd results in
05-09 12:45:12.051: E/AndroidRuntime(530): FATAL EXCEPTION: main` 05-09 12:45:12.051: E/AndroidRuntime(530): java.lang.RuntimeException: Unable to start activity ComponentInfo{giv.home/giv.home.Start}: android.os.NetworkOnMainThreadException 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread.access$600(ActivityThread.java:123) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.os.Handler.dispatchMessage(Handler.java:99) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.os.Looper.loop(Looper.java:137) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-09 12:45:12.051: E/AndroidRuntime(530): at java.lang.reflect.Method.invokeNative(Native Method) 05-09 12:45:12.051: E/AndroidRuntime(530): at java.lang.reflect.Method.invoke(Method.java:511) 05-09 12:45:12.051: E/AndroidRuntime(530): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 05-09 12:45:12.051: E/AndroidRuntime(530): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 05-09 12:45:12.051: E/AndroidRuntime(530): at dalvik.system.NativeStart.main(Native Method) 05-09 12:45:12.051: E/AndroidRuntime(530): Caused by: android.os.NetworkOnMainThreadException 05-09 12:45:12.051: E/AndroidRuntime(530): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099) 05-09 12:45:12.051: E/AndroidRuntime(530): at java.net.InetAddress.lookupHostByName(InetAddress.java:391) 05-09 12:45:12.051: E/AndroidRuntime(530): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242) 05-09 12:45:12.051: E/AndroidRuntime(530): at java.net.InetAddress.getAllByName(InetAddress.java:220) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 05-09 12:45:12.051: E/AndroidRuntime(530): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 05-09 12:45:12.051: E/AndroidRuntime(530): at giv.home.ConnectionClass.connectToServer(ConnectionClass.java:41) 05-09 12:45:12.051: E/AndroidRuntime(530): at giv.home.Start.onCreate(Start.java:64) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.Activity.performCreate(Activity.java:4465) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 05-09 12:45:12.051: E/AndroidRuntime(530): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 05-09 12:45:12.051: E/AndroidRuntime(530): ... 11 more