gustavogenovese/curl-android-ios

Can not build for the android test app

Closed this issue · 1 comments

I was happy to see the prebuilt curl libraries, and I had assumed it would built. Unfortunately my trial turned out otherwise:

  1. Pull down the source code
  2. Enter the folder:test-android-project\app\src\main
  3. Run ndk-build.cmd from a windows command console

I got a bunch of errors similar to the following:
C:\git\curl-android-ios\test-android-project\app\src\main>ndk-build[arm64-v8a] SharedLibrary : libtestlibrary.so
jni/../../../../../prebuilt-with-ssl/android/arm64-v8a/libcurl.a(url.o): In function Curl_disconnect':(.text.Curl_disconnect+0x64): undefined reference to Curl_http_ntlm_cleanup'
jni/../../../../../prebuilt-with-ssl/android/arm64-v8a/libcurl.a(http.o): In function output_auth_headers':(.text.output_auth_headers+0x7c): undefined reference to Curl_output_ntlm'

If you want to build "from scratch" the prebuilt libraries, you have a problem and that is because you're running Windows. This project is about the scripts to build the libraries on Linux or MacOS.
Unfortunately, the building process is not a simple step, (running ndk-build as you did). It requires a number of steps described in the scripts for that purpose. Take a look at the build_Android.sh script, located in the curl-compile-scripts folder.
From there you can either adapt/translate the script to .bat or whatever format Windows uses nowadays, or install Bash for Windows.

Now, if you want to run the Android sample project, I would use the gradle script for that instead of building manually. You can either run gradlew.bat assembleDebug from your console or open the project with Android Studio. In the app/build.gradle file you'll see how you're supposed to run ndk-build