Skip to content

Commit

Permalink
android,test: use NDK r18b for building
Browse files Browse the repository at this point in the history
Updates the documentation to use NDK r18b for building.
Also updates the gradle version used in the test application
to be compatible with NDK r18b.
  • Loading branch information
jaimecbernardo committed Nov 6, 2018
1 parent 6e361e5 commit 175e0c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ sudo apt-get install -y build-essential git python
sudo apt-get install -y curl unzip
```

#### Install Android NDK r17b for Linux:
#### Install Android NDK r18b for Linux:
Choose a location where you want to install the Android NDK and run:
```sh
curl https://dl.google.com/android/repository/android-ndk-r17b-linux-x86_64.zip -o ndk.zip
curl https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip -o ndk.zip
unzip ndk.zip
```
It will create a `android-ndk-r17b` folder. Save that path for later.
It will create a `android-ndk-r18b` folder. Save that path for later.

### Prerequisites to build the Android library on macOS:

Expand All @@ -62,13 +62,13 @@ As an alternative, installing one of these will install `git`:
* [Homebrew](https://brew.sh/)
* [Git-SCM](https://git-scm.com/download/mac)

#### Install Android NDK r17b for macOS:
#### Install Android NDK r18b for macOS:
Choose a location where you want to install the Android NDK and run:
```sh
curl https://dl.google.com/android/repository/android-ndk-r17b-darwin-x86_64.zip -o ndk.zip
curl https://dl.google.com/android/repository/android-ndk-r18b-darwin-x86_64.zip -o ndk.zip
unzip ndk.zip
```
It will create a `android-ndk-r17b` folder. Save that path for later.
It will create a `android-ndk-r18b` folder. Save that path for later.

### Building the Android library on Linux or macOS:

Expand All @@ -82,11 +82,11 @@ git checkout mobile-master

#### 2a) Using the Android helper script:

The `tools/android_build.sh` script takes as first argument the Android NDK path (in our case is `~/android-ndk-r17b`). The second argument is optional and is the target architecture, which can be one of the following: `arm`, `x86`, `arm64` or `x86_64`. If no target architecture is provided, it will build all available architectures.
The `tools/android_build.sh` script takes as first argument the Android NDK path (in our case is `~/android-ndk-r18b`). The second argument is optional and is the target architecture, which can be one of the following: `arm`, `x86`, `arm64` or `x86_64`. If no target architecture is provided, it will build all available architectures.
Run:

```sh
./tools/android_build.sh ~/android-ndk-r17b
./tools/android_build.sh ~/android-ndk-r18b
```

When done, each built shared library will be placed in `out_android/$(ARCHITECTURE)/libnode.so`.
Expand All @@ -95,7 +95,7 @@ When done, each built shared library will be placed in `out_android/$(ARCHITECTU
Run the `android-configure` script to configure the build with the path to the downloaded NDK and the desired target architecture.

```sh
source ./android-configure ../android-ndk-r17b arm
source ./android-configure ../android-ndk-r18b arm
```

Start the build phase:
Expand Down
2 changes: 1 addition & 1 deletion tools/mobile-test/android/prepare-android-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ adb $TARGET shell 'am force-stop nodejsmobile.test.testnode'
# Clean the Android log
adb logcat -c

adb $TARGET install -r "$TEST_APP_BASE_DIR/app/build/outputs/apk/app-debug.apk"
adb $TARGET install -r "$TEST_APP_BASE_DIR/app/build/outputs/apk/debug/app-debug.apk"

# Start the test app without parameter in order to copy the assets to a writable location
adb $TARGET shell 'am start -n nodejsmobile.test.testnode/nodejsmobile.test.testnode.MainActivity' > /dev/null
Expand Down
1 change: 0 additions & 1 deletion tools/mobile-test/android/testnode/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "nodejsmobile.test.testnode"
minSdkVersion 23
Expand Down
3 changes: 2 additions & 1 deletion tools/mobile-test/android/testnode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Nov 10 10:55:45 CET 2017
#Tue Nov 06 10:48:47 GMT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 comments on commit 175e0c8

Please sign in to comment.