ZBar - QR code扫描仪,在崩溃的Andr​​oid工作室扫描仪、工作室、QR、ZBar

2023-09-06 14:40:57 作者:韶华易逝

我从git的最新zBar QR code扫描仪(SDK 0.2)下载。我想在我的应用程序来实现它。我工作在Android工作室。

I have downloaded from git latest zBar QR Code Scanner (SDK 0.2). I am trying to implement it in my application. I work on Android Studio.

我做了什么:

在我抄zBar.jar到LIBS我的项目文件夹中。 我已经通过zip'ing,并改变它们的格式,以创建从amerabi,amerabi-V7A,86* .jar文件的* .jar。 在我抄amerabi.jar,amerabi-v7a.jar和x86.jar到LIBS我的项目文件夹中。

有没有必要,因为它已被配置来导入库项目中的每个jar文件在摇篮改变任何东西。请看下图: I have copied zBar.jar to libs folder of my Project. I have created *.jar files from "amerabi", "amerabi-v7a", "x86" by zip'ing them and changing their format to *.jar. I have copied amerabi.jar, amerabi-v7a.jar and x86.jar to libs folder of my Project.

There is no need to change anything in gradle because it is already configured to import every jar file from libs projects. See below:

dependencies {
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.crashlytics.android:crashlytics:1.+'

    compile fileTree(dir: 'libs', include: '*.jar')

    compile project(':FacebookSDK')
    compile project(':actionbarsherlock')
    compile project(':Aviary-SDK')
}

每个类的形式zBar lib中可以看出,所以我已经配置好了一切。我跑我的ScannerActivity和的onCreate我得到这一行错误:

Every class form zBar lib can be seen so I have configured everything. I run my ScannerActivity and in onCreate I get error in this line:

scanner = new ImageScanner();  // this line shows an error
scanner.setConfig(0, Config.X_DENSITY, 3);
scanner.setConfig(0, Config.Y_DENSITY, 3);

所以实现是1:1的相同示例在。

So implementation is 1:1 the same as in example.

我的错误日志:

java.lang.UnsatisfiedLinkError: Couldn't load zbarjni from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/pl.toptof.android.debug-2.apk"],nativeLibraryDirectories=[/data/app-lib/pl.toptof.android.debug-2, /vendor/lib, /system/lib]]]: findLibrary returned null

请帮我看看这个问题。我不知道为什么我的Andr​​oid Studio可以看到lib中,但不能在它的例子中使用的相同方式使用它。

Please help me with that problem. I don't know why my Android Studio can see lib but can't use it in the same way it's used in example.

推荐答案

我想,你在你的罐子结构出错了。如果你想从*。所以库使jar包,你应该使用这种结构的:

I think, you made mistake in your jars structures. If you want to make jar package from *.so libs you should use that kind of structure:

/ lib中/ armeabi / *。所以

/lib/armeabi/*.so

这是你的库目录结构,例如:

It is directory structure example for your library:

lib/
---/armeabi
------/libiconv.so
------/libzbarjni.so

和你当然应该从lib.zip最终改名包armeabi.jar。你的情况,你应该为armeabi-V7A和x86重复这个过程。

and of course you should rename final package from lib.zip to armeabi.jar. In your case you should repeat this process for armeabi-v7a and x86.