X5内核不兼容的问题32-bit instead of 64-bit

最近项目导入了X5内核做webview兼容,引入之后,在测试机上崩溃了,日志如下:
TBS:initX5Core – loadSucc: false; exception: java.lang.reflect.InvocationTargetException; cause: java.lang.UnsatisfiedLinkError: dlopen failed: “/data/data/com.tencent.mm/app_tbs/core_share/libmttwebview.so” is 32-bit instead of 64-bit
at java.lang.Runtime.load(Runtime.java:344)
at java.lang.System.load(System.java:1079)
at com.tencent.smtt.webkit.ContextHolder.loadMttWebViewLib(Unknown Source)
at com.tencent.smtt.webkit.ContextHolder.setContext(Unknown Source)
at com.tencent.smtt.webkit.ContextHolder.setContext(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.tencent.tbs.x5core.X5CoreInit.setContextHolderParams(Unknown Source)
at com.tencent.tbs.tbsshell.TBSShell.initX5CoreImpl(Unknown Source)
at com.tencent.tbs.tbsshell.WebCoreProxy.canUseX5(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.tencent.smtt.sdk.bi.a(Unknown Source)
at com.tencent.smtt.sdk.bh.a(Unknown Source)
at com.tencent.smtt.sdk.WebView.a(Unknown Source)
at com.tencent.smtt.sdk.WebView.(Unknown Source)
at com.tencent.smtt.sdk.WebView.(Unknown Source)
at com.tencent.smtt.sdk.WebView.(Unknown Source)
at com.tencent.smtt.sdk.WebView.(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:641)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:791)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:731)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:862)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:825)
at android.view.LayoutInflater.inflate(LayoutInflater.java:537)
at android.view.LayoutInflater.inflate(LayoutInflater.java:437)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:428)
at android.app.Activity.setContentView(Activity.java:2221)
at com.ciyun.appfanlishop.activities.fanli.WebViewActivity.onCreate(WebViewActivity.java:70)
at android.app.Activity.performCreate(Activity.java:6372)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
at android.app.ActivityThread.access 900 ( A c t i v i t y T h r e a d . j a v a : 168 ) a t a n d r o i d . a p p . A c t i v i t y T h r e a d 900(ActivityThread.java:168) at android.app.ActivityThread 900(ActivityThread.java:168)atandroid.app.ActivityThreadH.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5665)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)

导致这个问题的原因就是标红的提示,就是因为兼容包的问题

解决: 把两个包下面的额so文件统一,直接把32-bit so文件复制到64位目录下面
并在配置文件build.gradle中加入配置:defaultConfig {ndk {abiFilters “x86”, “armeabi”, “armeabi-v7a”, ‘arm64-v8a’ }}

编译,通过!!!!

注意:如果有崩溃的情况,还需要在gradle.properties中加入系统兼容配置:
Android.useDeprecatedNdk=true

到这里,兼容性问题就解决了

你可能感兴趣的:(踩坑)