Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target Android 29 bbc.sh revamped to pull release from github directly
- Loading branch information
1 parent
2873bc5
commit afe4542
Showing
3 changed files
with
119 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
# build babble core (bbc) | ||
set -e | ||
|
||
babble_core_version=9ad37c8cf79f61a9d40e88e949c6a0f1840e23a7 | ||
BABBLE_CORE_RELEASE_VERSION="0.5.9" | ||
|
||
if [ -d jni ]; then rm -rf jni; fi | ||
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" | ||
|
||
if [ -d build ]; then rm -r build; fi | ||
mkdir build | ||
cd build | ||
|
||
if [ -z ${GOPATH+x} ]; then | ||
# GOPATH is not set, so we'll use the standard Go tree | ||
cp ~/go/src/github.com/mosaicnetworks/babble/src/mobile/build/${babble_core_version}/mobile.aar . | ||
else | ||
cp ${GOPATH}/src/github.com/mosaicnetworks/babble/src/mobile/build/${babble_core_version}/mobile.aar . | ||
# Create tmp working sub directory | ||
if [ -d "${mydir}/tmp" ] ; then | ||
rm -rf "${mydir}/tmp" | ||
fi | ||
mkdir -p "${mydir}/tmp" | ||
|
||
unzip mobile.aar -d mobile.aar.unzip | ||
cd .. | ||
cp build/mobile.aar.unzip/classes.jar . | ||
cp -r build/mobile.aar.unzip/jni . | ||
# Get released library | ||
RELEASE_ZIP="https://github.com/mosaicnetworks/babble/releases/download/v${BABBLE_CORE_RELEASE_VERSION}/babble_${BABBLE_CORE_RELEASE_VERSION}_android_library.zip" | ||
|
||
rm -r build | ||
wget -q -O ${mydir}/tmp/babble.zip "$RELEASE_ZIP" | ||
ret=$? | ||
|
||
if [ $ret -ne 0 ] ; then | ||
echo "Failed to download release $RELEASE_ZIP" | ||
fi | ||
|
||
# unzip into the tmp folder | ||
unzip ${mydir}/tmp/babble.zip -d ${mydir}/tmp | ||
|
||
if [ -d "${mydir}/jni" ]; then rm -rf "${mydir}/jni"; fi | ||
|
||
cd "${mydir}/tmp" | ||
|
||
unzip babble_${BABBLE_CORE_RELEASE_VERSION}_mobile.aar -d unzip | ||
|
||
cd ${mydir} | ||
cp tmp/unzip/classes.jar . | ||
cp -r tmp/unzip/jni . | ||
|
||
rm -rf tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
|
||
|
||
# Dependencies | ||
|
||
Install Android Studio. I installed version 3.5.2.0 via the `Ubuntu Software` app, which installs a `snap` version. This is a 700Mb download, and snap will likely keep 2 or 3 version of it. | ||
|
||
If there is no prepackaged version for your OS, you can download it directly from [here](https://developer.android.com/studio). | ||
|
||
Set ANDROID_HOME environment variable. Add it to ``.bashrc`` or ``.profile``. | ||
|
||
Accept the Android SDK licenses: | ||
|
||
```bash | ||
jon@hpjon:~/Android$ $ANDROID_HOME/tools/bin/sdkmanager --licenses | ||
Warning: File /home/jon/.android/repositories.cfg could not be loaded. | ||
5 of 5 SDK package licenses not accepted. 100% Computing updates... | ||
Review licenses that have not been accepted (y/N)? y | ||
|
||
... | ||
``` | ||
|
||
If you then launch Android Studio, it gives a warning that no SDK has been found and gives you the option to install one. I accepted the defaults and it installed Android 29. | ||
|
||
|
||
|
||
|
||
---- | ||
|
||
Clone the repository: | ||
|
||
```bash | ||
jon@hpjon:~$ mkdir Android | ||
jon@hpjon:~$ cd Android | ||
jon@hpjon:~/Android$ git clone https://github.com/mosaicnetworks/babble-android.git | ||
Cloning into 'babble-android'... | ||
remote: Enumerating objects: 745, done. | ||
remote: Counting objects: 100% (745/745), done. | ||
remote: Compressing objects: 100% (344/344), done. | ||
remote: Total 745 (delta 251), reused 675 (delta 181), pack-reused 0 | ||
Receiving objects: 100% (745/745), 35.61 MiB | 7.27 MiB/s, done. | ||
Resolving deltas: 100% (251/251), done. | ||
``` | ||
|
||
---- | ||
|
||
Open the babble-android project within Android Studio. | ||
|
||
|
||
## Build the aar library | ||
|
||
First some dependencies: | ||
|
||
Install the Android NDK. Instructions are [here](https://developer.android.com/ndk/guides/index.html). | ||
|
||
In Android Studio, Tools/SDK Manager. Under the SDK Tools tab, choose to install LLDB, NDK(Side by side) and CMake. | ||
|
||
In a terminal session, clone Babble. | ||
|
||
```bash | ||
~/Android/Sdk/ndk$ ln -s 20.0.5594570/ latest | ||
|
||
$ go get golang.org/x/mobile/cmd/gomobile | ||
$ go get golang.org/x/tools/go/packages | ||
$ | ||
$ cd [...babble]/src/mobile | ||
|
||
$ export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/latest | ||
$ gomobile init | ||
$ gomobile bind -v -target=android -tags=mobile . | ||
$ mkdir -p build/test ; mv mobile.aar mobile-sources.jar build/test | ||
`` | ||
|
||
```bash | ||
jon@hpjon:~/Android/babble-android/babble/libs$ bash ./bbc.sh | ||
Archive: mobile.aar | ||
inflating: mobile.aar.unzip/AndroidManifest.xml | ||
inflating: mobile.aar.unzip/proguard.txt | ||
inflating: mobile.aar.unzip/classes.jar | ||
inflating: mobile.aar.unzip/jni/armeabi-v7a/libgojni.so | ||
inflating: mobile.aar.unzip/jni/arm64-v8a/libgojni.so | ||
inflating: mobile.aar.unzip/jni/x86/libgojni.so | ||
inflating: mobile.aar.unzip/jni/x86_64/libgojni.so | ||
inflating: mobile.aar.unzip/R.txt | ||
creating: mobile.aar.unzip/res/ | ||
``` | ||
|
||
|
||
` | ||