简体   繁体   English

未找到Android设备中USB4java使用的本机库异常

[英]Native library not found exception for usb4java usage in android device

I want to develop usb application with usb4java for Android device. 我想使用usb4java为Android设备开发USB应用程序。 I'm using Android Studio as an IDE and Ubuntu 14.04 as an operating system. 我将Android Studio用作IDE,将Ubuntu 14.04用作操作系统。 I have added usb4java-1.2.0 file to my project. 我已将usb4java-1.2.0文件添加到我的项目中。 I can use Libusb function in my application. 我可以在应用程序中使用Libusb函数。 Firstly I wrote LibUsb.init() function in my MainActivity but there is an error about native library. 首先,我在MainActivity中编写了LibUsb.init()函数,但是关于本机库有一个错误。 I'm getting classloader exception. 我收到类加载器异常。

Caused by: org.usb4java.LoaderException: Native library not found in classpath: /org/usb4java/linux-armv7l/libusb4java.so 引起原因:org.usb4java.LoaderException:在类路径中找不到本机库:/org/usb4java/linux-armv7l/libusb4java.so

I have analyzed Unsupported Platform tag in http://usb4java.org/nativelibs.html website. 我已经在http://usb4java.org/nativelibs.html网站中分析了Unsupported Platform标记。 But I couldn't solve my problem with this way. 但是我不能用这种方式解决我的问题。 After that I read https://github.com/usb4java/libusb4java and again I couldn't solve my problem with this way. 之后,我阅读了https://github.com/usb4java/libusb4java ,然后我又无法用这种方式解决我的问题。 Can you help me please. 你能帮我吗。

The problem you're seeing is that LibUsb is trying to find the .so file, rather using the android load library calls. 您看到的问题是LibUsb尝试查找.so文件,而不是使用android加载库调用。 So you'll need to edit that. 因此,您需要对其进行编辑。 After that it may or may not work. 之后,它可能会或可能不会工作。 But it would probably be smarter to use the USB functionality built into Android rather than a lower level library trying to use the Linux OS underneath it- it might not work at all, or may have unusual bugs due to interacting with Android. 但是,使用Android内置的USB功能而不是尝试在其下使用Linux OS的较低层库可能会更聪明-它可能根本不起作用,或者由于与Android交互而可能会出现异常错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM