Note that there are some explanatory texts on larger screens.

plurals
  1. POGet "CURLE_COULDNT_RESOLVE_HOST" error in Android
    text
    copied!<p>I have compiled static libcurl for android but continuously receiving the CurlRes code 6 i.e. CURLE_COULDNT_RESOLVE_HOST.</p> <h2>Android.mk</h2> <pre><code>LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := Curl LOCAL_SRC_FILES := prebuild/libcurl.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ccSharedLib LOCAL_SRC_FILES := main-jni.cpp LOCAL_STATIC_LIBRARIES := Curl include $(BUILD_SHARED_LIBRARY) </code></pre> <hr> <h2>main-jni.cpp</h2> <pre><code>extern "C" { size_t write_data(void *ptr, size_t size, size_t count, FILE *stream) { size_t written; written = fwrite(ptr, size, count, stream); printf("data sent, size = %lu",written); return written; } jint Java_com_example_testlibcurl_MainActivity_test1( JNIEnv* env, jobject thiz, jstring downloadDirectoryPath) { CURLcode res; res = curl_global_init(CURL_GLOBAL_ALL); jint temp = 3; printf("Method called"); const char *nativeDownloadDirPath = env-&gt;GetStringUTFChars(downloadDirectoryPath,0); // Test code for calling methods of libCURL CURL *curl; FILE *fp; std::string s = "http://travel.paintedstork.com/blog/wp-content/uploads/2012/10/2013-calendar-images-1.jpg"; curl = curl_easy_init(); if(curl) { fp = fopen(nativeDownloadDirPath, "wb"); res = curl_easy_setopt(curl, CURLOPT_URL, s.c_str()); res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); res = curl_easy_perform(curl); curl_easy_cleanup(curl); if(fp) fclose(fp); } return res; } } </code></pre> <p>This code is downloading the image from a web source, but every time when "curl_easy_perform" method is called it gives the error code 6. I have checked this with different URL but still unsuccessful :( ...</p> <p>"android.permission.INTERNET" and "android.permission.WRITE_EXTERNAL_STORAGE" permissions already given in Manifest file.</p> <p>Any pointer to solve this will be a great help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload