From 8cfcbb85f0f2146f61784eca159d617bc3d8c26f Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Wed, 21 Nov 2018 21:32:32 -0800 Subject: [PATCH] Fix ReactAndroid build break. (#22377) Summary: During C++ build, we need the libjsc.so. But arm64-v8a and x86_64 libjsc.so are in different path and this error raised: Android NDK: ERROR:/home/circleci/react-native/ReactAndroid/build/third-party-ndk/jsc/Android.mk:jsc: LOCAL_SRC_FILES points to a missing file /opt/ndk/android-ndk-r17c/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop. Android NDK: Check that /home/circleci/react-native/ReactAndroid/build/third-party-ndk/jsc/jni/arm64-v8a/libjsc.so exists or that its path is correct The commit moves prebuilt libjsc.so into ReactAndroid/src/main/jni/third-party/jsc/jni and let ndkbuild script find the prebuilt libjsc.so. For AAR packaging, modify the jniLibs so that gradle android library plugin could find the prebuilt libjsc.so as well. Pull Request resolved: https://github.com/facebook/react-native/pull/22377 Differential Revision: D13166556 Pulled By: hramos fbshipit-source-id: 61daaede7defbc66491a3e2f20058e7d248ba13e --- ReactAndroid/build.gradle | 4 ++-- .../third-party/jsc/jni}/arm64-v8a/libjsc.so | Bin .../third-party/jsc/jni}/x86_64/libjsc.so | Bin 3 files changed, 2 insertions(+), 2 deletions(-) rename ReactAndroid/src/main/{jniLibs => jni/third-party/jsc/jni}/arm64-v8a/libjsc.so (100%) rename ReactAndroid/src/main/{jniLibs => jni/third-party/jsc/jni}/x86_64/libjsc.so (100%) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index c1dd696afe3a7d..6855cfba03d905 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -162,7 +162,7 @@ task prepareJSC(dependsOn: dependenciesPath ? [] : [downloadJSCHeaders]) << { copy { from zipTree(configurations.compile.fileCollection { dep -> dep.name == 'android-jsc' }.singleFile) from dependenciesPath ? "$dependenciesPath/jsc-headers" : {downloadJSCHeaders.dest} - from 'src/main/jni/third-party/jsc/Android.mk' + from 'src/main/jni/third-party/jsc' include 'jni/**/*.so', '*.h', 'Android.mk' filesMatching('*.h', { fname -> fname.path = "JavaScriptCore/${fname.path}"}) into "$thirdPartyNdkDir/jsc"; @@ -289,7 +289,7 @@ android { sourceSets.main { jni.srcDirs = [] - jniLibs.srcDir "$buildDir/react-ndk/exported" + jniLibs.srcDirs = ["$buildDir/react-ndk/exported", 'src/main/jni/third-party/jsc/jni'] res.srcDirs = ['src/main/res/devsupport', 'src/main/res/shell', 'src/main/res/views/modal', 'src/main/res/views/uimanager'] java { srcDirs = ['src/main/java', 'src/main/libraries/soloader/java', 'src/main/jni/first-party/fb/jni/java'] diff --git a/ReactAndroid/src/main/jniLibs/arm64-v8a/libjsc.so b/ReactAndroid/src/main/jni/third-party/jsc/jni/arm64-v8a/libjsc.so similarity index 100% rename from ReactAndroid/src/main/jniLibs/arm64-v8a/libjsc.so rename to ReactAndroid/src/main/jni/third-party/jsc/jni/arm64-v8a/libjsc.so diff --git a/ReactAndroid/src/main/jniLibs/x86_64/libjsc.so b/ReactAndroid/src/main/jni/third-party/jsc/jni/x86_64/libjsc.so similarity index 100% rename from ReactAndroid/src/main/jniLibs/x86_64/libjsc.so rename to ReactAndroid/src/main/jni/third-party/jsc/jni/x86_64/libjsc.so