Skip to content

Raise out android-jsc issues in current master #22274

Closed
@Kudo

Description

@Kudo

Environment

React Native Environment Info:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 4.55 GB / 16.00 GB
Shell: 5.6.2 - /usr/local/bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
Build Tools: 21.1.2, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 27.0.0, 27.0.1, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 17, 19, 22, 23, 25, 26, 27, 28
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild

Description

There are two issues for current approach of android-jsc adoption. Related to #18754.

  1. The minSdkVersion is implicitly changed to API 21.
    Running on Android < 5 will have launch crash.
    Since this android-jsc is built by NDK APP_PLATFORM 21,
    there are some unresolved symbols for Android < 5 devices. E.g. sigemptyset

  2. Build break once published out as AAR format.
    Currently the dependency of android-jsc is added by this line.
    compile project(':android-jsc')
    For Android library as AAR, this dependency just tells the integrated application there is a 'android-jsc' package need to further resolved. Neither jar nor *.so will be packed into react-native AAR.
    User does not have android-jsc in their gradle projects, the dependency not found problem will cause build break.
    (Google plans to officially support fat aar in gradle plugin, which is fulfill this case to bundle all things in one AAR, but not ready yet.)

Reproducible Demo

  1. The minSdkVersion is implicitly changed to API 21.
    Simply do ./gradlew :RNTester:android:app:installDebug on Android 4.1 emulator and check adb log for missing symbols.
    E.g.
         AndroidRuntime  E  FATAL EXCEPTION: create_react_context
                         E  java.lang.ExceptionInInitializerError
                         E      at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:25)
                         E      at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944)
                         E      at java.lang.Thread.run(Thread.java:856)
                         E  Caused by: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so caused by: couldn't find DSO to load: libjsc.so caused by: Can
                            not load library: reloc_library[1306]:  1138 cannot locate 'sigemptyset'...
                         E      at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:703)
                         E      at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:564)
                         E      at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:500)
                         E      at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:455)
                         E      at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:30)
                         E      at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:19)
                         E      ... 3 more
  1. For RNTester to use AAR dependency.
    1. Apply this patch. Assume your $HOME is /Users/foo.
    2. Build AAR and deployed at mavenLocal: ./gradlew :ReactAndroid:uploadArchives
    3. Build RNTester: ./gradlew :RNTester:android:app:assembleDebug
    4. This is the build error:
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':RNTester:android:app:debugCompileClasspath'.
> Could not find react-native:android-jsc:unspecified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions