反应本机期望java.lang.UnsatisfiedLinkError:dlopen失败:“ /data/data/{package}/lib-main/libgnustl_shared.so”;是32位而不是64位 [英] React native expection java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/{package}/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit

查看:711
本文介绍了反应本机期望java.lang.UnsatisfiedLinkError:dlopen失败:“ /data/data/{package}/lib-main/libgnustl_shared.so”;是32位而不是64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将React Native与我现有的Android应用程序集成。初始化React Native屏幕时出现以下异常:


java.lang.UnsatisfiedLinkError:dlopen失败:
/ data / data / com.snapdeal.main / lib-main / libgnustl_shared.so是32位
而不是64位


该应用仅在64位设备上崩溃。



根据我到目前为止的学习,我发现此<在React Native Repo上报告了一个href = https://github.com/oney/react-native-webrtc/issues/121 rel = noreferrer>问题,但解决方案对此线程没有帮助,因为我没有在现有应用程序中使用任何外部SO库。 / p>

除了上面的内容外,我还意识到安装我的应用程序的设备上库结构的另一个不同之处。我正在比较我的应用程序与React Native演示应用程序的结构。



反应演示应用程序

  root @ generic_x86_64:** / data / data / com.react.demo / lib **#ls 
libfb.so
libfolly_json.so
libglog.so
libglog_init.so
libgnustl_shared.so
libicu_common.so
libimagepipeline.so
libjsc.so
libreactnativejni.so
libreactnativejnifb.so

根@ generic_x86_64:/ data / data / ** com.react.demo ** / lib-main#ls
dso_deps
dso_lock
dso_manifest
dso_state

我的应用

  root @ generic_x86_64:/ data / data / ** com.my.app ** / lib-main#ls 
dso_deps
dso_lock
dso_manifest
dso_state
libfb.so
libfolly_json.so
libglog.so
libglog_init.so
libgnustl_shared.so
libicu_common.so
libimagepipeline.so
libjsc.so
libreactnativejni.so
libreactnativejnifb.so

共享少量有关我的项目的更多详细信息:



package.json

  {
name: projectname,
版本: 1.0.0,
描述:本地NPM,
main: index.js,
脚本:{
test: echo \错误:未指定测试\&&出口1,
开始:节点node_modules / react-native / local-cli / cli.js开始
},
存储库:{
type : git,
url:
},
author: Ishan D,
license: ISC,
dependencies:{
react: ^ 15.3.2,
react-native: ^ 0.37.0,
react-native-linear-gradient : ^ 1.5.15,
rn-viewpager: ^ 1.1.3
},
devDependencies:{}
}

在Android本机项目中使用的依赖项

  ext {
compileSdkVersion = 24
buildToolsVersion = '24 .0.2'
minSdkVersion = 16
targetSdkVersion = 24
supportLibrariesVersion = '23 .0.1'
playServiceVersion ='9.0.2'

dep = [
fabricPlugin:'io.fabric',
fabricMavenUrl:'https: //maven.fabric.io/public',
fabricClasspath:'io.fabric.tools:gradle: 1。+,

playServiceClasspath: com.google.gms:google-services:1.3.0-beta1,
playServicePlugin: com.google.gms.google-services ,

playServiceAppindexing: com.google.android.gms:play-services-appindexing:$ playServiceVersion,
playServiceLocation: com.google.android.gms:play-services-location :$ playServiceVersion,
playServiceVision: com.google.android.gms:play-services-vision:$ playServiceVersion,
playServiceAuth: com.google.android.gms:play-services-auth :$ playServiceVersion,
playServiceBase: com.google.android.gms:play-services-base:$ playServiceVersion,
playServiceIdentity: com.google.android.gms:play-services-identity :$ playServiceVersion,
playServiceAnalytics: com.google.android.gms:play-services-analytics:$ playServiceVersion,
playServiceGcm: com.google.and roid.gms:play-services-gcm:$ playServiceVersion,

underCouchClasspath: de.undercouch:gradle-download-task:2.0.0,
underCouchPluigin: de.undercouch .download',

crashlytics:'com.crashlytics.sdk.android:crashlytics:2.4.0@aar',

moengage:'com.moengage:moe-android -sdk:6.0.29',

supportV4: com.android.support:support-v4:$supportLibrariesVersion,
supportAppCompatV7: com.android.support:appcompat-v7: $ supportLibrariesVersion,
supportCardviewV7: com.android.support:cardview-v7:$supportLibrariesVersion,
supportDesignV7: com.android.support:design:$supportLibrariesVersion,

okhttp:'com.squareup.okhttp:okhttp:2.5.0',
junit:'junit:junit:4.12',
mockito:'org.mockito:mock ito-core:1.10.19'
]
}

任何线索都是赞赏。



PS:我知道react-native确实支持64位二进制文​​件,并且我没有使用任何外部库。

解决方案

将以下内容添加到app / gradle文件中

  defaultConfig {
....

ndk {
abiFilters armeabi-v7a, x86,'armeabi','arm64-v8a'
}

packagingOptions {
排除 lib / arm64-v8a / libgnustl_shared.so
}
}

还请确保您使用相同的端口。

  adb反向tcp:8081 tcp:8081 


I am trying to integrate React Native with my existing Android App. I am getting the following exception, when initilizing React Native Screen:

java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.snapdeal.main/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit

The App is only crashing on 64-bit devices.

As per my learning so far, I've found this issue reported on React Native Repo, but the solution suggested in this thread is not helpful as I am not using any external SO library in existing App.

Apart from above, I've realized another difference in library structure on the device where my App is installed. I am comparing structure of my App vs react native demo app.

React demo App

root@generic_x86_64:**/data/data/com.react.demo/lib** # ls
libfb.so
libfolly_json.so
libglog.so
libglog_init.so
libgnustl_shared.so
libicu_common.so
libimagepipeline.so
libjsc.so
libreactnativejni.so
libreactnativejnifb.so

root@generic_x86_64:/data/data/**com.react.demo**/lib-main # ls
dso_deps
dso_lock
dso_manifest
dso_state

My App

root@generic_x86_64:/data/data/**com.my.app**/lib-main # ls
dso_deps
dso_lock
dso_manifest
dso_state
libfb.so
libfolly_json.so
libglog.so
libglog_init.so
libgnustl_shared.so
libicu_common.so
libimagepipeline.so
libjsc.so
libreactnativejni.so
libreactnativejnifb.so

Sharing few more details about my project:

package.json

{
  "name": "projectname",
  "version": "1.0.0",
  "description": "Native NPM",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "author": "Ishan D",
  "license": "ISC",
  "dependencies": {
    "react": "^15.3.2",
    "react-native": "^0.37.0",
    "react-native-linear-gradient": "^1.5.15",
    "rn-viewpager": "^1.1.3"
  },
  "devDependencies": {}
}

dependencies used in android native project

ext {
    compileSdkVersion = 24
    buildToolsVersion = '24.0.2'
    minSdkVersion = 16
    targetSdkVersion = 24
    supportLibrariesVersion = '23.0.1'
    playServiceVersion = '9.0.2'

    dep = [
            fabricPlugin          : 'io.fabric',
            fabricMavenUrl        : 'https://maven.fabric.io/public',
            fabricClasspath       : 'io.fabric.tools:gradle:1.+',

            playServiceClasspath  : 'com.google.gms:google-services:1.3.0-beta1',
            playServicePlugin     : 'com.google.gms.google-services',

            playServiceAppindexing: "com.google.android.gms:play-services-appindexing:$playServiceVersion",
            playServiceLocation   : "com.google.android.gms:play-services-location:$playServiceVersion",
            playServiceVision     : "com.google.android.gms:play-services-vision:$playServiceVersion",
            playServiceAuth       : "com.google.android.gms:play-services-auth:$playServiceVersion",
            playServiceBase       : "com.google.android.gms:play-services-base:$playServiceVersion",
            playServiceIdentity   : "com.google.android.gms:play-services-identity:$playServiceVersion",
            playServiceAnalytics  : "com.google.android.gms:play-services-analytics:$playServiceVersion",
            playServiceGcm        : "com.google.android.gms:play-services-gcm:$playServiceVersion",

            underCouchClasspath   : 'de.undercouch:gradle-download-task:2.0.0',
            underCouchPluigin     : 'de.undercouch.download',

            crashlytics           : 'com.crashlytics.sdk.android:crashlytics:2.4.0@aar',

            moengage              : 'com.moengage:moe-android-sdk:6.0.29',

            supportV4             : "com.android.support:support-v4:$supportLibrariesVersion",
            supportAppCompatV7    : "com.android.support:appcompat-v7:$supportLibrariesVersion",
            supportCardviewV7     : "com.android.support:cardview-v7:$supportLibrariesVersion",
            supportDesignV7       : "com.android.support:design:$supportLibrariesVersion",

            okhttp                : 'com.squareup.okhttp:okhttp:2.5.0',
            junit                 : 'junit:junit:4.12',
            mockito               : 'org.mockito:mockito-core:1.10.19'
    ]
}

Any clue is appreciated.

PS: I know react-native does support 64-bit binaries and I am not using any external library.

解决方案

Add the following into app/gradle file

defaultConfig {
....

    ndk {
        abiFilters "armeabi-v7a", "x86", 'armeabi', 'arm64-v8a'
    }

    packagingOptions {
        exclude "lib/arm64-v8a/libgnustl_shared.so"
    }
}

also make sure you working with the same port.

adb reverse tcp:8081 tcp:8081

这篇关于反应本机期望java.lang.UnsatisfiedLinkError:dlopen失败:“ /data/data/{package}/lib-main/libgnustl_shared.so”;是32位而不是64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆