4

Can somebody teach me or point me to a tutorial on how to install libiconv for android? I've been googling for 3 days and I can't find a tutorial or a how-to.

Coola
  • 479
  • 1
  • 8
  • 15
  • 1
    The Java library provides all the charset conversion services you might need. Just sayin'. Then again, if porting existing iconv-based code... – Seva Alekseyev Apr 04 '12 at 02:20
  • I think it would just be a matter of building it (from source) for Android. I doubt there is an Android-targetted version that you can just "install". Get the source, create an Android.mk file to compile the source (look at the makefiles provided with libiconv so you know what files to compile) and ndk-build the sucker. – Samuel Apr 04 '12 at 02:54
  • Actually, I am trying to build and compile some c++ files in android ndk but an error occured "undefined reference to libiconv_open, libiconv and libiconv_close", which means some c++ files used iconv, that's why I want to install/compile libiconv to android-ndk so my files will build successfully. Can you suggest anything? or Am i going for a wrong solution regarding the errors? – Coola Apr 04 '12 at 02:58
  • @Coola It might be easier to just add libiconv to the project you're building instead of building it as a separate library. Still, check out the link in my answer. It gives you the things you'll need to add to your existing makefile, and it also reveals the necessary files that you'll need to add to your project. – Samuel Apr 04 '12 at 03:08
  • Ok, thanks Samuel, I'll see what I can do – Coola Apr 04 '12 at 05:01
  • Refer to this post, it's seem your answer: [http://stackoverflow.com/questions/9053702/building-libiconv-fails-with-the-android-standalone-toolchain/10051212#10051212][1] [1]: http://stackoverflow.com/questions/9053702/building-libiconv-fails-with-the-android-standalone-toolchain/10051212#10051212 – binhgreat Apr 07 '12 at 02:27

2 Answers2

5

Grab the libiconv source, and make an Android.mk makefile. Look at this site for a prewritten makefile for libiconv and Android. Once you have the Android.mk file you can build using the ndk-build script.

Samuel
  • 16,923
  • 6
  • 62
  • 75
0

My guess is that you don't need iconv on Android. Android should be all UTF-8 everywhere, so there should be no need for character conversion. Maybe there are cases where you want your app to edit foreign files in all sorts of charsets, that's the only reason I can think of where an Android app would need iconv.

So instead of trying to include libiconv, perhaps you should just change whatever code you are using that requires libiconv so that it does not require it when running on Android.

  • Granted, the question isn't well stated. Any time you are cross-compiling using the NDK, and that library that requires iconv you'll find yourself asking this question. – Cameron Lowell Palmer Jan 02 '17 at 22:47