Error resolving address on Android 4.4.4

Jan 15, 2016 at 3:35 PM
Edited Jan 15, 2016 at 3:36 PM
Hi all,

I've managed to compile casablanca for android using a ubuntu machine. The compilation went fine. Now when I integrate casablanca with my Android app I'm getting an exception and the message is "Error resolving address". What could cause this? The same code works fine on my OSX machine .....

Here is my simple code
int MyClass::test() {
    http_client client(U("http://www.bing.com/"));

    try {
        client.request(methods::GET).get();
    }
    catch(std::exception& e) {

        __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "exception: %s" , e.what());

    }
    //return response.status_code();

    return 1;
} 
and here is my Android.mk file
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_atomic
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_atomic-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_chrono
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_chrono-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_date_time
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_date_time-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_filesystem
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_filesystem-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_random
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_random-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_system
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_system-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := boost_thread
LOCAL_SRC_FILES := ../extLibs/boost/lib/libboost_thread-clang-mt-1_55.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/boost/include/boost-1_55/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := openssl_ssl
LOCAL_SRC_FILES := ../extLibs/openssl/lib/libssl.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/openssl/include/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := openssl_crypto
LOCAL_SRC_FILES := ../extLibs/openssl/lib/libcrypto.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/openssl/include/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := casablanca
LOCAL_SRC_FILES := ../extLibs/casablanca/lib/libcpprest.a
LOCAL_EXPORT_C_INCLUDES := ../extLibs/casablanca/include/

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := myjnitest
LOCAL_SRC_FILES := swig_wrap.cxx myclass.cpp
LOCAL_CPPFLAGS := -std=c++11 -pthread -frtti -fexceptions
LOCAL_ARM_MODE := arm
LOCAL_LDLIBS := -llog -lm

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../extLibs/casablanca/include/
LOCAL_STATIC_LIBRARIES += casablanca

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../extLibs/openssl/include/
LOCAL_STATIC_LIBRARIES += openssl_ssl openssl_crypto

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../extLibs/boost/include/boost-1_55
LOCAL_STATIC_LIBRARIES += boost_thread boost_random boost_system boost_filesystem boost_date_time boost_chrono boost_atomic

include $(BUILD_SHARED_LIBRARY)
Jan 15, 2016 at 3:43 PM
I even tried the IP address directly and it's giving the following error message "Failed to connect to any resolved endpoint"
Jan 15, 2016 at 5:55 PM
Edited Jan 15, 2016 at 6:10 PM
I found my error ... a small mistake on my part ... I didn't add the permissions for internet access in the manifest file.
Marked as answer by roschuma on 1/15/2016 at 10:33 AM