Skip to content

Commit

Permalink
add x86_64 arm64-v8a support. Fixes facebook#2814 (facebook#18754)
Browse files Browse the repository at this point in the history
Summary:
add arm64 support, related issue : facebook#2814.
If we are okay with binary aar android-jsc, then the pr can be directly merged. Otherwise merge facebookarchive/android-jsc#30 first and do a new release.

RNTester all variant works. You can also test the apk from here: https://github.com/gengjiawen/react-native/releases/tag/v0.56beta.

facebookarchive/android-jsc#30.

 [ANDROID] [ENHANCEMENT] [ABI] - add x86_64 arm64-v8a support.

Differential Revision: D9491481

Pulled By: hramos

fbshipit-source-id: d6ec6992768eb0c0866a0317273e09fae5b8935e
  • Loading branch information
gengjiawen authored and facebook-github-bot committed Sep 24, 2018
1 parent ef863c0 commit 0a2825f
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 28 deletions.
21 changes: 2 additions & 19 deletions RNTester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ apply from: "../../../react.gradle"
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
def enableSeparateBuildPerCPUArchitecture = true

/**
* Run Proguard to shrink the Java bytecode in release builds.
Expand All @@ -93,9 +93,6 @@ android {
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
Expand All @@ -110,7 +107,7 @@ android {
enable enableSeparateBuildPerCPUArchitecture
universalApk false
reset()
include "armeabi-v7a", "x86"
include "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
}
}
buildTypes {
Expand All @@ -123,20 +120,6 @@ android {
signingConfig signingConfigs.release
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ dependencies {
api "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}"
api "com.squareup.okhttp3:okhttp-urlconnection:${OKHTTP_VERSION}"
api 'com.squareup.okio:okio:1.14.0'
compile 'org.webkit:android-jsc:r174650'
compile project(':android-jsc')

testImplementation "junit:junit:${JUNIT_VERSION}"
testImplementation "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_BUILD_SCRIPT := Android.mk

APP_ABI := armeabi-v7a x86
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
APP_PLATFORM := android-16

APP_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
CXX11_FLAGS := -Wno-unused-variable -Wno-unused-local-typedefs
LOCAL_CFLAGS += $(CXX11_FLAGS)

include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)
Binary file added android-jsc/android-jsc.aar
Binary file not shown.
2 changes: 2 additions & 0 deletions android-jsc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('android-jsc.aar'))
7 changes: 2 additions & 5 deletions local-cli/templates/HelloWorld/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,13 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
include "armeabi-v7a", "x86", "arm64-v8a"
}
}
buildTypes {
Expand All @@ -126,7 +123,7 @@ android {
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
Expand Down
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

include ':ReactAndroid', ':RNTester:android:app'
include ':ReactAndroid'
include ':RNTester:android:app'
include ':android-jsc'

0 comments on commit 0a2825f

Please sign in to comment.