reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
219 stars 328 forks source link

android原生项目集成reactnative模块,当点击按钮跳转到reactnative页面报错,非常急,急,急如律令 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~VRMqytafdeaHmCq0vdk2uw==/com.changan.caftbase-Jjr_e11nK5egu6uEG2Yepw==/lib/arm64/libfolly_runtime.so"... java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~VRMqytafdeaHmCq0vdk2uw==/com.changan.caftbase-Jjr_e11nK5egu6uEG2Yepw==/lib/arm64/libfolly_runtime.so"... #894

Open xwj006 opened 1 month ago

xwj006 commented 1 month ago
                                    android原生项目集成reactnative模块,当点击按钮跳转到reactnative页面报错                                                             java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~VRMqytafdeaHmCq0vdk2uw==/com.changan.caftbase-Jjr_e11nK5egu6uEG2Yepw==/lib/arm64/libfolly_runtime.so"...

ndk使用的26.3.11579264, android { namespace 'com.xxxxxxxx' compileSdk 33

defaultConfig {
    applicationId "com.xxxxx.xxxxx" // 对应jush包名
    minSdk 24
    targetSdk 33
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables {
        useSupportLibrary true
    }

    externalNativeBuild {
        cmake {
            cppFlags "-std=c++11 -frtti -fexceptions"
            arguments "-DANDROID_STL=c++_shared"
        }
    }
    // 配置jpush
    ndk {
        //选择要添加的对应 cpu 类型的 .so 库。
        abiFilters 'armeabi-v7a', 'arm64-v8a'
        // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
    }

    manifestPlaceholders = [
            // 包名 请设置
            JPUSH_PKGNAME : "com.changan.caftbase",
            //JPush 上注册的包名对应的 Appkey.
            JPUSH_APPKEY : "你的 Appkey ",
            //暂时填写默认值即可.
            JPUSH_CHANNEL : "developer-default",

            //若不集成厂商通道,可直接跳过以下配置

// MEIZU_APPKEY : "MZ-魅族的APPKEY", // MEIZU_APPID : "MZ-魅族的APPID", // XIAOMI_APPID : "MI-小米的APPID", // XIAOMI_APPKEY : "MI-小米的APPKEY", // OPPO_APPKEY : "OP-oppo的APPKEY", // OPPO_APPID : "OP-oppo的APPID", // OPPO_APPSECRET : "OP-oppo的APPSECRET", // VIVO_APPKEY : "vivo的APPKEY", // VIVO_APPID : "vivo的APPID", // HONOR_APPID : "Honor的APP ID", ] // 配置jpush结束 packagingOptions { resources { excludes += '/META-INF/{AL2.0,LGPL2.1}' } pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' } }

// 指定 NDK 版本
ndkVersion '26.3.11579264'

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
//此处配置必须添加 否则无法正确运行
aaptOptions {
    additionalParameters '--auto-add-overlay'
    //noCompress 'foo', 'bar'
    ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
    jvmTarget = '1.8'
}
buildFeatures {
    compose true
}
composeOptions {
    kotlinCompilerExtensionVersion '1.3.2'
}

}

sunnylqm commented 1 month ago

https://github.com/mrousavy/react-native-mmkv/issues/487#issuecomment-1360940419