Skip to content

Commit 77d64e7

Browse files
authored
Merge pull request #173 from firebase/feature/js-android-abis
Build all Android ABIs available in NDK r16b. The most recent versions of the NDK don't support the "mips", "mips64", and "armeabi" ABIs, but we still do ship those with the binary C++ SDK to support older devices. This change adds a check to our Android gradle build, which determines whether a custom NDK is being used (as we do in our packaging step), and builds those additional ABIs if the NDK version is the one we expect. Our custom Android build script supports building with NDK r16b to enable all 3 STL variants as well as the aforementioned older ABIs. This change also includes an option to build the armeabi-v7a-hard ABI, which was removed a few years ago and subsumed into armeabi-v7a, and thus shouldn't normally be required. (But if you do need armeabi-v7a-hard for some reason, you can use NDK r11c.)
2 parents 4ba9d36 + d54b619 commit 77d64e7

File tree

13 files changed

+53
-0
lines changed

13 files changed

+53
-0
lines changed

admob/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
9091
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9192
project.afterEvaluate {

analytics/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
9091
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9192
project.afterEvaluate {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Set the list of Android ABIs depending on whether we the NDK_ROOT environment
16+
// variable contains the text 'r16b' in it. This will generally only occur
17+
// during C++ packaging, which uses /tmp/android-ndk-r16b as the NDK directory.
18+
// When using this NDK version, add a few additional ABIs that are only
19+
// supported in r16b and earlier.
20+
21+
android {
22+
defaultConfig {
23+
ndk {
24+
// Default list of ABIs available in up-to-date NDK.
25+
abiFilters "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
26+
27+
if (System.getenv('NDK_ROOT').contains('r16b') ||
28+
System.getenv('NDK_ROOT').contains('r11c')) {
29+
// Deprecated ABIs are added to the list when building using older NDKs only.
30+
// Rather than an exhaustive list, we only support r11c and r16b.
31+
abiFilters.add("armeabi")
32+
abiFilters.add("mips")
33+
abiFilters.add("mips64")
34+
if (System.getenv('NDK_ROOT').contains('r11c')) {
35+
abiFilters.add("armeabi-v7a-hard") // Removed after r11c.
36+
}
37+
}
38+
}
39+
}
40+
}
41+

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ android {
7979
}
8080
}
8181

82+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8283
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
8384
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
8485
project.afterEvaluate {

auth/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
9091
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9192
project.afterEvaluate {

database/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
9091
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9192
project.afterEvaluate {

dynamic_links/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9091
project.afterEvaluate {
9192
generateProguardFile('dynamic_links')

firestore/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/extract_and_dex.gradle"
9091
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9192
project.afterEvaluate {

functions/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9091
project.afterEvaluate {
9192
generateProguardFile('functions')

instance_id/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ android {
8686
dependencies {
8787
implementation project(':app')
8888
}
89+
apply from: "$rootDir/android_build_files/android_abis.gradle"
8990
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
9091
project.afterEvaluate {
9192
generateProguardFile('instance_id')

0 commit comments

Comments
 (0)