Reputation: 13
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
Upvotes: 0
Views: 292
Reputation: 215
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 :)
Upvotes: 3
Reputation: 13
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
Upvotes: 0