I am using the latest version of Android Studio 0.2.6 and the latest version of the Android ZKar Android SDK. What i have done so far:
- Created a new project called QRTest
- Created a folder called libs in my project
- Put the contents of the Zbar libs directory in the project folder
- Right click on the zbar.jar file in my project and add it to the library
In my build.gradle file, edited it so that it is now:
dependencies {msgstr "compile files ('libs / zbar.jar')}
- Basically copied the sample code from the ZBar android SDK sample example into my own project.
- The project compiles and works fine (0 errors, 0 warnings), but it crashes on failure. Magazines show:
09-01 16: 06: 02.026: W / dalvikvm (7050): Ljava exception / languages / UnsatisfiedLinkError; throws when initializing Lnet / SourceForge / Zbar / ImageScanner;
09-01 16: 06: 02.036: E / AndroidRuntime (7050): called: java.lang.UnsatisfiedLinkError: Unable to load library: link_image [1891]: 209 failed to load the library 'libiconv.so' for 'libzbarjni.so' ( load_library [1093]: Library 'libiconv.so' not found)
09-01 16: 06: 02.036: E / AndroidRuntime (7050): at net.sourceforge.zbar.ImageScanner. (Unknown source)
Looking at the code in my MainActivity, it seems to die here:
scanner = new ImageScanner();
Which seems to me that I somehow did not import the Zbar library files correctly. Any help on how to get this very simple example would be greatly appreciated!
Just note that if I use Android Studio to import a new project from the ZBar Android SDK example, it compiles and works fine. However, it uses the old ant build system. I would rather use the new gradle build system, which is why I am trying to import ZBar into a new Android 0.2.6 project. Thanks!
Another note: I tried changing my gradle assembly to the accepted answer here: How to change the libs directory in Gradle? and it didn’t work.

source share