实施zxing-2.0到我的Andr​​oid应用 [英] Implement zxing-2.0 into my android app

查看:145
本文介绍了实施zxing-2.0到我的Andr​​oid应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想实现一个进入我的应用程序,但问题是,它不会作为一个单独的应用程序工作,所以美眉evrytime我启动它。我做的事情埃夫里在随后的教程<一个href=\"http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/\" rel=\"nofollow\">http://damianflannery.word$p$pss.com/2011/06/13/integrate-zxing-bar$c$c-scanner-into-your-android-app-natively-using-eclipse/然而,它在某种程度上是行不通的。所以我tryied启动captureActivity作为应用程序,而不是库,并且当它试图这样做,它崩溃上启动:

So i'm trying to implement that into my app, however the problem is that it doesn't work as a solo application so it crush evrytime i start it. I do evry thing as in followed tutorial http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/ however, it somehow doesn't work. So i tryied to start the captureActivity as application rather than library, and it crashes on start when it tries to do that:

 private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
  EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
             ResultMetadataType.SUGGESTED_PRICE,
             ResultMetadataType.ERROR_CORRECTION_LEVEL,
             ResultMetadataType.POSSIBLE_COUNTRY);

这导致了我没有正确编译core.jar添加的问题。但是我看不到的地方,我会做一个错误。我在运行核心目录蚂蚁-f,它给了我core.jar添加。任何想法我能做什么?

That leads to the problem that i didn't compile core.jar correctly. However i can't see where would i do a mistake. I run ant -f in core directory, and it gives me core.jar. Any ideas what could i do?

编辑:logcat的:

edit: logcat:

 01-06 02:07:08.280: E/AndroidRuntime(1629): FATAL EXCEPTION: main
 01-06 02:07:08.280: E/AndroidRuntime(1629): java.lang.ExceptionInInitializerError
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at java.lang.Class.newInstanceImpl(Native Method)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at java.lang.Class.newInstance(Class.java:1409)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.os.Handler.dispatchMessage(Handler.java:99)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.os.Looper.loop(Looper.java:130)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at android.app.ActivityThread.main(ActivityThread.java:3683)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at java.lang.reflect.Method.invokeNative(Native Method)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at java.lang.reflect.Method.invoke(Method.java:507)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at dalvik.system.NativeStart.main(Native Method)
 01-06 02:07:08.280: E/AndroidRuntime(1629): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
 01-06 02:07:08.280: E/AndroidRuntime(1629):    at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:107)
 01-06 02:07:08.280: E/AndroidRuntime(1629):    ... 15 more
 01-06 02:07:08.740: E/GoKeyboard(1442): error setSuggestions isNotInput()!
 01-06 02:07:09.140: E/GoKeyboard(1442): error setSuggestions isNotInput()!
 01-06 02:07:11.600: E/GoKeyboard(1442): error setSuggestions isNotInput()!
 01-06 02:07:11.600: E/GoKeyboard(1442): error setSuggestions isNotInput()!

现在我下载了核心从这里 http://mvnrepository.com/artifact /com.google.zxing/core/2.0 ,并用它来偷同样的错误,所以它必须是别的东西......

Now i downloaded the core from here http://mvnrepository.com/artifact/com.google.zxing/core/2.0 and used it and steal same mistake so it must be something else...

推荐答案

转到属性 - > Java构建路径 - >排序和导出

Go to Properties -> Java Build Path -> "Order and Export"

然后责令core.jar添加到第一的位置并选择它!

Then order the core.jar to the first position and select it!

您必​​须在手术后清理项目。项目 - >清除

you must clean your project after your operation. Project -> clean

这解决了这个问题。我希望这样可以节省别人的时间。

That solves the problem. I hope it saves somebody's time.

这篇关于实施zxing-2.0到我的Andr​​oid应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆