build libusb for Android
平臺
libusb版本:libusb-1.0.20
Ubuntu: 14.04
NDK:android-ndk-r9d
測試手機:三星S4
開發板:GD32
==================
Building:
---------
To build libusb for Android do the following:
1. Download the latest NDK from:
http://developer.android.com/tools/sdk/ndk/index.html
2. Extract the NDK.
3. Open a shell and make sure there exist an NDK global variable
set to the directory where you extracted the NDK.
4. Change directory to libusb's "android/jni"
5. Run "ndk-build".(需要設定環境變數或者使用絕對路徑)
The libusb library, examples and tests can then be found in:
"android/libs/$ARCH"
Where $ARCH is one of:
armeabi(測試使用此架構,armeabi-v7a未測試)
armeabi-v7a
x86
Installing:
-----------
For a rooted device it is possible to install libusb into the system
image of a running device:
1. Connect the device to a machine running ADB.
2. Execute the following commands on the machine
running ADB:
# Make the system partition writable
adb shell su -c "mount -o remount,rw /system"
# Install libusb
adb push obj/local/armeabi/libusb1.0.so /sdcard/
adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"
adb shell rm /sdcard/libusb1.0.so
Test:
-----------
1. new project file
1) 任意目錄下mkdir libusb_for_android
2) 在libusb_for_android/ 新增libusb1.0.so、libusb.h、usbtest2.0.c,並且新建jni目錄
3) 在jni/ 新建Android.mk和Application.mk
2. 在jni/下執行:/opt/android_ndk/android-ndk-r9d/ndk-build
在libusb_for_android/libs/armeabi/下即可找到產生的可執行檔案usbtest
3. 將usbtest adb push到手機的sdcard/
4. 將開發板和手機相連,然後再手機的超級終端下執行:./usbtest
相關文章
- libusb android ndk編譯--編譯mipsAndroid編譯
- libusb:libusb_bulk_transfer的timeout引數問題
- Qt for android編譯大坑之adb: failed to stat build-test-andoid5_12_8/android-build//build/QTAndroid編譯AIUI
- libusb開發者指南
- 【Android Build】高效批量打渠道包AndroidUI
- How to compile libusb as shared/static libraryCompile
- Android Build系統要點總結AndroidUI
- Android開發:build.gradle 配置指南AndroidUIGradle
- 解決Android打包com.android.build.api.transform.TransformException的問題AndroidUIAPIORMException
- 用Android SDK Build Tools手動構建APKAndroidUIAPK
- Android學習筆記之build.gradle檔案Android筆記UIGradle
- Android原始碼編譯jar包BUILD_JAVA_LIBRARY 與BUILD_STATIC_JAVA_LIBRARY的區別(一)Android原始碼編譯JARUIJava
- Android Studio 已有專案新增NDK支援(mac/ndk-build)AndroidMacUI
- 如何在Android studio中更新sdk版本和build-tools版本AndroidUI
- 瑞芯微 RK3399 android7.1 wifi驅動build in 方式AndroidWiFiUI
- 報錯com.android.build.api.transform.TransformException: java.util.zip.ZipException:AndroidUIAPIORMExceptionJava
- com.android.build.api.transform.TransformException: Error while generating the main dex list.AndroidUIAPIORMExceptionErrorWhileAI
- Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3HTTPGoAndroidMavenUIGradle
- linux下 libusb使用--開啟usb裝置進行通訊Linux
- DDK中"checked build"和"free build" 之區別UI
- _get_usbfs_fd libusb couldn‘t open the usb 許可權不夠
- Build mysql replicationUIMySql
- ubuntu Realsense buildUbuntuUI
- chrome devtools buildChromedevUI
- builder.Build()UI
- A. Build a ComputerUI
- Android Studio ERROR: Installed Build Tools revision 34.0.0 is corrupted. Remove and install again using the SDK Manager.AndroidErrorUIREMAI
- Android NDK開發(二) 使用ndk-build構建工具進行NDK開發AndroidUI
- Flutter雜症( flutter packages pub run build_runner build )FlutterPackageUI
- gradle升級到4.1後出現的Could not resolve com.android.tools.build:gradle:3.0.1GradleAndroidUI
- How to Build a Cybersecurity CareerUI
- webpack build報錯WebUI
- TeamCity : Build 基本配置UI
- thinkphp升級後報錯Declaration of thinkappUrl::build() must be compatible with think outeUrl::build():PHPAPPUI
- TensorFlow Build from Source for macOSUIMac
- how to build a website like apkmirrorUIWebAPK
- Apache JMeter 5.4.1 Build DevelopmentApacheJMeterUIdev
- Eclipse解決Project中Java Build Path 提示 2 build peth entriesare missing.EclipseProjectJavaUI