6

I migrated an android project from Eclipse to Android Studio, and updated the NDK. When I build the solution I had this error:

Error:(61, 2) error: format not a string literal and no format arguments [-Werror=format-security]

Here is the error

I can't find any solution, so I am thinking that I have to downgrade the NDK. Is there another way to resolve this? If not, how can I downgrade my NDK to r8e?

A.Edwar
  • 341
  • 3
  • 12
Walid
  • 700
  • 2
  • 10
  • 29

1 Answers1

23

In order to downgrade your ndk, you will have to pull it from the internet with wget and move it into your Android SDK dir:

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
  • When I do this .. with version 16 it still says 17 when I reopen AS? – justdan0227 Mar 28 '18 at 20:40
  • 1
    @justdan0227 Check your project structure in Android Studio, and make sure you are pointing to your custom downloaded NDK, not AS default one. – IgorGanapolsky Mar 28 '18 at 20:46
  • 1
    Thanks.. I had to uninstall the NDK, then copy the 16 version over to the android home folder and go into AS and point the NDK folder to the 16 version. The check mark in the SDK tools is still un-checked, however my cpp code now compiles – justdan0227 Mar 28 '18 at 21:02
  • If you have an existing NDK, better remove that `rm -rf $ANDROID_HOME/ndk-bundle` and then `mv` the new one onto it e.g. `mv android-ndk-r16b $ANDROID_HOME/ndk-bundle` – Roy Shilkrot Oct 09 '18 at 15:58