|
| 1 | +<!-- |
| 2 | +The MIT License (MIT) |
| 3 | +
|
| 4 | +Copyright (c) 2016, 2024 IBM Corporation, Carnegie Mellon University and others |
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +of this software and associated documentation files (the "Software"), to deal |
| 7 | +in the Software without restriction, including without limitation the rights |
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +copies of the Software, and to permit persons to whom the Software is |
| 10 | +furnished to do so, subject to the following conditions: |
| 11 | +
|
| 12 | +The above copyright notice and this permission notice shall be included in all |
| 13 | +copies or substantial portions of the Software. |
| 14 | +
|
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | +SOFTWARE. |
| 22 | +--> |
| 23 | + |
| 24 | +# NavCogAndroid |
| 25 | + |
| 26 | +Android version of example application "NavCog". |
| 27 | + |
| 28 | +## About |
| 29 | +[About HULOP](https://github.com/hulop/00Readme) |
| 30 | + |
| 31 | +## License |
| 32 | +[MIT](http://opensource.org/licenses/MIT) |
| 33 | + |
| 34 | +## Prerequisites |
| 35 | +- Android Studio and Android SDK (Android 13 SDK 33 or later) |
| 36 | +- CocoaPods (1.6.1 or later) |
| 37 | +- cmake (3.15.2 or later) |
| 38 | + |
| 39 | +## Dependent libraries |
| 40 | +- [HULOP blelocpp](https://github.com/hulop/blelocpp) (MIT License) |
| 41 | +- [OpenCV (OpenCV-Dynamic) 4.0.1](https://opencv.org/releases/) (BSD License) |
| 42 | + |
| 43 | +### About libopencv_java4.so |
| 44 | + |
| 45 | +Please put **libopencv_java4.so** from Android pack OpenCV-android-sdk (under /sdk/native/libs folder) into folders below: |
| 46 | + |
| 47 | +- /app/src/main/jniLibs/arm64-v8a |
| 48 | +- /app/src/main/jniLibs/armeabi-v7a |
| 49 | +- /app/src/main/jniLibs/x86_64 |
| 50 | + |
| 51 | +OpenCV-android-sdk can be found at [https://opencv.org/releases/](https://opencv.org/releases/). |
| 52 | + |
| 53 | +(Currently, HULOP uses version [4.0.1](https://sourceforge.net/projects/opencvlibrary/files/4.0.1/). If needed, please use an appropriate version of so file.) |
| 54 | + |
| 55 | +## How to build |
| 56 | + |
| 57 | +### Install CocoaPods (If you have not installed) |
| 58 | +- Install and update Homebrew |
| 59 | +- $brew install python |
| 60 | +- $pip install mercurial |
| 61 | +- Install CocoaPods |
| 62 | + |
| 63 | +### Install cmake (version 3.15.2) |
| 64 | +- $brew instal cmake |
| 65 | + |
| 66 | +### Build bleloc Framework for Android |
| 67 | +1. Follow instructions of [blelocpp](https://github.com/hulop/blelocpp/tree/master) |
| 68 | + - If you want to build Android version only, you don't need to do the final step ($sh build.sh Release). |
| 69 | + |
| 70 | +2. If OpenCV-Dynamic4.0.1 can't install well. Please try to use Homebrew as below. |
| 71 | + |
| 72 | + 1. $brew install opencv |
| 73 | + 2. $cd blelocpp/platform/ios |
| 74 | + 3. Comment out the line below from Podfile. |
| 75 | + ``` |
| 76 | + pod 'OpenCV-Dynamic', '4.0.1' |
| 77 | + ``` |
| 78 | + 4. $pod install |
| 79 | + 5. Modify **NavCogAndroid/app/CMakeLists.txt** to include OpenCV as below. |
| 80 | + ``` |
| 81 | + # Use OpenCV via Homebrew |
| 82 | + include_directories(/usr/local/opt/opencv/include/opencv4) |
| 83 | + ``` |
| 84 | + 6. Go to Build step. (Step 3 below is not required.) |
| 85 | +
|
| 86 | +3. If `Pods/Headers/Public/OpenCV-Dynamic` does not exist, copy header files into `Pods/Headers/Public/OpenCV-Dynamic`. |
| 87 | +
|
| 88 | + ``` |
| 89 | + cd blelocpp/platform/ios |
| 90 | + mkdir -p Pods/Headers/Public/OpenCV-Dynamic/opencv2 |
| 91 | + cp -R Pods/OpenCV-Dynamic/opencv2.framework/Headers/ Pods/Headers/Public/OpenCV-Dynamic/opencv2 |
| 92 | + ``` |
| 93 | +
|
| 94 | +### Build |
| 95 | +Build the example app by using Android Studio. |
| 96 | +
|
| 97 | +## How to use local serverlist file for test. |
| 98 | +1. Enable adb shell |
| 99 | + - Install adb with Android Studio, and then add PATH for it. (For example, add line below into ~/.bashrc) |
| 100 | + ``` |
| 101 | + export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools |
| 102 | + ``` |
| 103 | +2. Find target folder in the Android device. |
| 104 | + * Connect target Android device with Mac, and then start ```adb shell``` |
| 105 | + * Find target folder (```/storage/self/primary/Android/data/hulop.navcog/files``` is the default.) |
| 106 | + * After confirm the target folder, ```exit``` from adb. |
| 107 | +3. Copy serverlist file(serverlist.txt or serverlist.json) into the target folder as below. |
| 108 | + * ```adb push serverlist.[txt|json] /storage/self/primary/Android/data/hulop.navcog/files``` |
| 109 | +
|
| 110 | +## Troubleshooting |
| 111 | +### build fail related to blelocpp |
| 112 | +Please try one of steps below, and try build again. |
| 113 | + - Delete `blelocpp/platform/ios/Pods`, and then `pod install` |
| 114 | + - **Build→Clean Project**, **Build→Refresh Linked C++ Projects** in Android Studio. |
0 commit comments