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下的使用例程Android
- libusb android ndk編譯--編譯mipsAndroid編譯
- libusb開發者指南
- 理解 Android Build 系統AndroidUI
- Qt for android編譯大坑之adb: failed to stat build-test-andoid5_12_8/android-build//build/QTAndroid編譯AIUI
- Build gdbserver for x86 AndroidUIServerAndroid
- com.android.tools.build:gradle:2.0.0-alpha3 build errorsAndroidUIGradleError
- 【Android Build】高效批量打渠道包AndroidUI
- Android Build系統要點總結AndroidUI
- 關於Android ant build的學習AndroidUI
- usb 3.0 linux libusb 問題Linux
- Android解決Couldnotfindcom.android.tools.build:gradleAndroidUIGradle
- Android開發:build.gradle 配置指南AndroidUIGradle
- Android學習之Build.xml檔案AndroidUIXML
- 用Android SDK Build Tools手動構建APKAndroidUIAPK
- How to compile libusb as shared/static libraryCompile
- Libusb開發教程 API介紹與使用API
- 解決Android打包com.android.build.api.transform.TransformException的問題AndroidUIAPIORMException
- Android Studio 編輯Build.gradle時很卡AndroidUIGradle
- Android Gradle 技巧之一: Build Variant 相關AndroidGradleUI
- Libusb開發教程 USB裝置程式開發
- Android學習筆記之build.gradle檔案Android筆記UIGradle
- Gradle for Android系列之二 build.gradle檔案GradleAndroidUI
- Error:Could not find com.android.tools.build:gradle:2.2.2.ErrorAndroidUIGradle
- com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:AndroidUIAPIORMExceptionIDE
- Android原始碼編譯jar包BUILD_JAVA_LIBRARY 與BUILD_STATIC_JAVA_LIBRARY的區別(一)Android原始碼編譯JARUIJava
- Build CookbookUI
- NDK buildUI
- Android Studio 已有專案新增NDK支援(mac/ndk-build)AndroidMacUI
- 深入淺出Android Gradle構建系統(三:build task)AndroidGradleUI
- 深入淺出Android Gradle構建系統(五:build type)AndroidGradleUI
- Gradle for Android 第二篇( Build.gradle入門 )GradleAndroidUI
- 深入淺出Android Gradle構建系統(3):build taskAndroidGradleUI
- 如何在Android studio中更新sdk版本和build-tools版本AndroidUI
- 報錯com.android.build.api.transform.TransformException: java.util.zip.ZipException:AndroidUIAPIORMExceptionJava
- com.Android.build.api.transform.TransformException:Java.util.zip.ZipException異常AndroidUIAPIORMExceptionJava
- Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.aErrorAIAPPORMJARAndroidUI
- DDK中"checked build"和"free build" 之區別UI