0

I ve developed Android Wear App also SDK is 4.4AW. After finished that applitacion I tested on new android wear SDK that is 5.0.1 Emulator AND motorola360(with 5.0.1) then I recived this errror (Show in the below)

Message Sum:

can't resolve host

Detailed Message:

Unable to resolve host "URL": No address associated with hostname

The App works perfect on 4.4 android wear but failed on 5.0.1 (I used Android studio and there is no Error before execution , Successful Build, Crash on Emulator.)

Im certainly sure that I used internet permision as u can see :

    <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature android:name="android.hardware.type.watch" />

Glade Detail :

apply plugin: 'com.android.application'

android { compileSdkVersion 21 buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.hakyazilim.onlywear"
    minSdkVersion 20
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:1.1.0'
    compile 'com.google.android.gms:play-services-wearable:6.5.87'
    compile files ('lib/android-async-http-1.4.3.jar')
}

I used "android-async-http-1.4.3.jar" Lib. Following this Code :

String requestURL = "My ASPX page (includes XML)";

    asyncHttpClient.get(requestURL, new AsyncHttpResponseHandler() {
        @Override
        public void onSuccess(String response) {
            try {
                mTextView.setText(response.toString());

            } catch (Exception e) {
                e.printStackTrace();
                Log.d(">>>>", "Part 1 Load Fail !");
            }
        }
        public void onFailure(Throwable e, String response) {
 //"EROR = can't resolve host"
        }
    });

Best regards
  • possible duplicate of [Direct internet connection on Android Wear?](http://stackoverflow.com/questions/24627174/direct-internet-connection-on-android-wear) – Nicolas POMEPUY Dec 31 '14 at 07:38
  • As explained here: http://stackoverflow.com/questions/24627174/direct-internet-connection-on-android-wear the Android Wear devices don't have access to a direct Internet connection. The calls should be done by the handheld device and synchronized with the data layer api. – Nicolas POMEPUY Dec 31 '14 at 07:39
  • But I could connect internet on wear (4.4W2) directly. I think this rules belongs 5.0 :( – Malik Hakyemez Dec 31 '14 at 22:16

1 Answers1

1

Even if Android 5.1.1 support Wi-Fi Feature.

It impossible to directly access the Internet in Android Wear.

You should stick to the Data Layer API , you cannot send http request directly from watch. Fetch internet data from the phone, then transfer it to watch with Data Layer API.

You can see this Does Android Wear support directly access the Internet?

And this document Always-on and Wi-Fi with the latest Android Wear update

Community
  • 1
  • 1
Hsiao yen
  • 71
  • 1
  • 5