簡體   English   中英

在 targetSDk 更改為 30 后,React Native android 應用程序在 Android 11 上崩潰

[英]React Native android application crashing on Android 11 after targetSDk changed to 30

我將 targetSDK 版本更改為 30 以符合 Play 商店。 該應用程序在啟動時立即崩潰。 在 StackOverflow 和 GitHub 上嘗試了所有解決方案。 注意:應用程序適用於 Android 9 及以下版本。

我從 logcat 獲得的日志,

/SoLoader: couldn't find DSO to load: libjscexecutor.so
E/SoLoader: couldn't find DSO to load: libhermes-executor-release.so
E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '108xxxxxxxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}
A/libc: /Users/willholen/intern/hermes/include/hermes/VM/HermesValue.h:195: static hermes::vm::HermesValue hermes::vm::HermesValue::encodeNativePointer(const void *): assertion "(reinterpret_cast<uintptr_t>(p) & ~kDataMask) == 0 && "Native pointer must contain zeroes in the high bits"" failed
 A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 22840 (mqt_js), pid 22732 (angle.traveller)

更新 okhttp3 就像下面的答案:

https://stackoverflow.com/a/68744493/7668448

或您的哨兵依賴:

https://stackoverflow.com/a/70049868/7668448

基本上,您需要確保更新依賴項並支持目標 sdk 30。

您可以在此處查看更多詳細信息:

https://github.com/facebook/react-native/issues/30366

通過執行以下步驟,我能夠修復此崩潰:

我在應用程序級別的 build.gradle 文件中添加了這些,

packagingOptions{
...
    pickFirst 'lib/x86_64/libjsc.so'
    pickFirst 'lib/arm64-v8a/libjsc.so'
}

dependencies {
  ...
  implementation 'com.facebook.soloader:soloader:0.8.2'
  implementation 'com.android.installreferrer:installreferrer:2.1'
 }

defaultConfig {
 ndk {
       abiFilters 'armeabi-v7a', 'x86'
     }
}

在干凈的構建和應用程序工作正常之后,不會像以前那樣崩潰。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM