0
Hi I am trying to build an system application in android build system which uses <zbar.jar> file" and "armeabi-v7a\libiconv.so" ,"armeabi-v7a\libzbarjni.so libs".

I get error as

09-21 21:14:32.614: E/AndroidRuntime(5217): java.lang.NoSuchFieldError: no field with name='data' signature='Ljava/lang/Object;' in class Lnet/sourceforge/zbar/Image;

09-21 21:14:32.614: E/AndroidRuntime(5217): at net.sourceforge.zbar.Image.init(Native Method)

09-21 21:14:32.614: E/AndroidRuntime(5217): at net.sourceforge.zbar.Image.(Unknown Source)

I have added dependencies in android.mk as below:

LOCAL_STATIC_JAVA_LIBRARIES := libzbar
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += libzbar:libs/zbar.jar

include $(CLEAR_VARS)
LOCAL_MODULE        := libiconv
LOCAL_MODULE_CLASS  := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_TAGS   := optional
LOCAL_SRC_FILES     := libiconv.so
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE        := libzbarjni
LOCAL_MODULE_CLASS  := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_TAGS   := optional
LOCAL_SRC_FILES     := libzbarjni.so
include $(BUILD_PREBUILT)

i have also enabled 
"proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt" line in project.properties and 
added "-keep class net.sourceforge.zbar.** { *; }" in progaurd.cfg file.

Any help is appreciated. Thanks

3 Answers 3

3

System builds use proguard file from: build\core\proguard.flags

If you have to define custom proguard, then in Android.mk you need to mention the file path: LOCAL_PROGUARD_FLAG_FILES := proguard-project.txt

And in the proguard-project.txt :

-keep class net.sourceforge.zbar.** { *; }

This will solve your problem .. I have personally tested :)

0
0

Try replacing LOCAL_SRC_FILES with BUILD_MULTI_PREBUILT.

1
  • Nikita Tiwari, i have tried this flag also, anyways i found the answer to this Sep 23, 2015 at 6:49
0

I found the answer to my question. adding the LOCAL_PROGUARD_ENABLED flag with false value solved my problem. adding this this will cause not to optimize the jar file and hence keep the data variable in Image class. i hope it will be helpful for someone facing similar problem. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.