本文介绍了Android的工作室0.2.6和ZBar项目设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我使用的是最新的Andr​​oid 0.2.6工作室和最新ZBar的Andr​​oid SDK。我迄今所做的:


  1. 创建一个名为QRTest一个全新的项目

  2. 创建一个文件夹,名为库在我的项目

  3. 把Zbar libs目录的内容到我的项目文件夹

  4. 右键单击该文件zbar.jar在我的项目,并添加为库

  5. 在我的build.gradle文件,编辑它,以便它现在是:

    依赖性{
       编译com.android.support:support-v4:13.0.0
       编译文件(库/ zbar.jar')
    }


  6. 基本上复制从ZBar Android SDK中的例子的例子code到我自己的项目。

  7. 项目编译并运行良好(0个错误,0警告),但它崩溃时运行。该日志显示:

Looking at the code in my MainActivity, it appears to be dying here:

 /* Instance barcode scanner */
 scanner = new ImageScanner();

Which seems to suggest to me that somehow I havent imported my Zbar library files correctly. Any help on how to get this very basic example up and going would be appreciated!

Just to note, if I use Android Studio to import a new project from the ZBar Android SDK example, it compiles and runs fine. However, it is using the old ant build system. I would rather use the new gradle build system, so thats why I'm trying to import ZBar into a fresh Android 0.2.6 project. Thanks!

Another note: I tried modifying my build gradle to the accepted answer here: Android Studio Zbar and it did not work.

解决方案

You should add *.so libraries to your project. If you use Android Studio and Gradle it's a little complicated because you need to pack libraries into jar. Check my answer here: ZBar - QR Code Scanner, crashing in Android Studio to see more details.

这篇关于Android的工作室0.2.6和ZBar项目设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 16:38