问题描述
我有一个带有 QR 扫描活动的 android 项目.我为此使用 ZBar 库:http://sourceforge.net/projects/zbar/files/AndroidSDK/
I have an android project with a QR scan activity. I use the ZBar library for this: http://sourceforge.net/projects/zbar/files/AndroidSDK/
如果项目是在带有 exlipse 的 PC 或 Mac 上构建的,则该应用程序运行良好.如果它是由 jenkins(来自 git 的相同来源)构建的,应用程序就会崩溃.
If the project is built on a PC or Mac with exlipse, the app works fine.If it's build by jenkins (same source from git) the app crashes.
我得到的异常是:
at controller.gui.activity.QRScanActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchFieldError: no field with name='peer' signature='J' in class Lnet/sourceforge/zbar/ImageScanner;
at net.sourceforge.zbar.ImageScanner.init(Native Method)
at net.sourceforge.zbar.ImageScanner.<clinit>(Unknown Source)
... 16 more
我使用演示应用程序作为基础.
I used the demo app for a base.
这是 Jenkins 配置问题吗?
Is this a Jenkins config problem?
Zbar 库不仅仅是一个 jar 文件,它还是一个带有 jni 的 C 库.所以我有一个 jar 文件和 3 个文件夹(我认为适用于不同的架构),它们有一个 libiconv.so 和一个 libzbarjni.so 文件.
The Zbar library is not just a jar file, it's a C library with jni. So I have a jar file and 3 folders (for different architectures I think) and they have a libiconv.so and a libzbarjni.so files.
推荐答案
添加 -keep class net.sourceforge.zbar.** { *;}
到你的 proguard 配置文件
Add -keep class net.sourceforge.zbar.** { *; }
to your proguard config file
这篇关于仅使用 Jenkins 构建的 Android ZBar 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!