0

My Android app has an NDK library. When running it on a Kindle Fire HD with Fire OS 4.5.5, the app fails to load the NDK library because some C standard library symbols are unresolved i.e. they appear to be entirely missing:

  • rand()
  • srand()
  • signal()

This problem does not happen on my Nexus 5 with stock Android 6.

Does anyone know why these symbols are missing entirely, and if there an official list somewhere of such missing symbols?

Are there any other "major" Android forks out there with such non-conventional C standard libraries?

UPDATE: I'm compiling the app and the NDK library using Android Studio 1.5.1 and the Gradle experimental plugin 0.4.0.

compileOptions.with {
    sourceCompatibility=JavaVersion.VERSION_1_7
    targetCompatibility=JavaVersion.VERSION_1_7
}

android {
    compileSdkVersion = 23
    buildToolsVersion = "23.0.2"

    defaultConfig.with {
        applicationId = "net.pol_online.hyper"
        minSdkVersion.apiLevel = 18  // Android 4.3 Jelly Bean
        targetSdkVersion.apiLevel = 23  // Android 6.0 Marshmallow
    }
}

UPDATE: The solution was to set this in the Gradle config as it turns out that minSdkVersion.apiLevel does not affect the NDK:

android.ndk {
   platformVersion = "18"
}
Pol
  • 3,848
  • 1
  • 38
  • 55

1 Answers1

0

Are you sure that you've built your NDK library targeting the right native API level? If you've built it targeting android-21 or newer and running on older android versions - especially these functions will fail. See https://stackoverflow.com/a/27338365/3115956 and https://stackoverflow.com/a/27093163/3115956 for more details.

Community
  • 1
  • 1
mstorsjo
  • 12,983
  • 2
  • 39
  • 62
  • I added the Gradle config to my question: I'm targeting `android-18`. – Pol Dec 30 '15 at 15:05
  • So I'm wondering if the issue is that even if I set the target API to 18 in the Gradle config, this somehow doesn't get passed to the NDK build? – Pol Dec 30 '15 at 15:26
  • I asked a separate question here: http://stackoverflow.com/questions/34532233/how-do-you-view-the-raw-gradle-build-log-for-the-ndk-in-android-studio. – Pol Dec 30 '15 at 15:31