我有一个cursoradapter(称为myadapter)用于listview来显示消息行。
但是,我收到一个用户(电话:mi 4i,android:5.0.2)的错误报告,说不满意的dlinkerror:dlopen失败:libwebviewchromium.so是32位而不是64位。
我相信错误是由设置了autolink=“all”的a textview生成的
但我不知道为什么会报告这个错误,因为我只是正常使用它。
myadapter中的newview函数:
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.item_message, parent, false);
return view;
}
项目信息.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/txtMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all" <!--error because of this line-->
android:text="MESSAGE"
android:textColor="@color/black"
android:textSize="14sp" />
</LinearLayout>
下面是堆栈跟踪:
android.view.InflateException: Binary XML file line #40: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:637)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:686)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:745)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:810)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:508)
at android.view.LayoutInflater.inflate(LayoutInflater.java:418)
at com.example.message.newView(MyAdapter.java:95)
at android.support.v4.widget.f.getView(CursorAdapter.java:252)
at android.widget.AbsListView.obtainView(AbsListView.java:2344)
at android.widget.ListView.makeAndAddView(ListView.java:1864)
at android.widget.ListView.fillSpecific(ListView.java:1344)
at android.widget.ListView.layoutChildren(ListView.java:1663)
at android.widget.AbsListView.onLayout(AbsListView.java:2148)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2099)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1856)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1081)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5818)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5234)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:611)
... 49 more
Caused by: android.util.AndroidRuntimeException: java.lang.RuntimeException: Cannot load WebView
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:117)
at android.webkit.WebView.getFactory(WebView.java:2191)
at android.webkit.WebView.findAddress(WebView.java:1628)
at android.text.util.Linkify.gatherMapLinks(Linkify.java:469)
at android.text.util.Linkify.addLinks(Linkify.java:234)
at android.widget.TextView.setText(TextView.java:3993)
at android.widget.TextView.setText(TextView.java:3915)
at android.widget.TextView.(TextView.java:1315)
at android.widget.TextView.(TextView.java:632)
at android.widget.TextView.(TextView.java:628)
... 52 more
Caused by: java.lang.RuntimeException: Cannot load WebView
at org.chromium.android_webview.AwBrowserProcess.loadLibrary(AwBrowserProcess.java:40)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.initialize(WebViewChromiumFactoryProvider.java:131)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.(WebViewChromiumFactoryProvider.java:100)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:112)
... 61 more
Caused by: org.chromium.base.library_loader.ProcessInitException
at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:271)
at org.chromium.base.library_loader.LibraryLoader.loadNow(LibraryLoader.java:148)
at org.chromium.android_webview.AwBrowserProcess.loadLibrary(AwBrowserProcess.java:34)
... 66 more
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: \"\/data\/app\/com.google.android.webview-2\/lib\/arm\/libwebviewchromium.so\" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:989)
at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:257)
... 68 more
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:611)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:686)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:745)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:810)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:508)
at android.view.LayoutInflater.inflate(LayoutInflater.java:418)
at com.example.message.newView(MyAdapter.java:95)
at android.support.v4.widget.f.getView(CursorAdapter.java:252)
at android.widget.AbsListView.obtainView(AbsListView.java:2344)
at android.widget.ListView.makeAndAddView(ListView.java:1864)
at android.widget.ListView.fillSpecific(ListView.java:1344)
at android.widget.ListView.layoutChildren(ListView.java:1663)
at android.widget.AbsListView.onLayout(AbsListView.java:2148)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15610)
at android.view.ViewGroup.layout(ViewGroup.java:4967)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2099)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1856)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1081)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5818)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5234)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: android.util.AndroidRuntimeException: java.lang.RuntimeException: Cannot load WebView
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:117)
at android.webkit.WebView.getFactory(WebView.java:2191)
at android.webkit.WebView.findAddress(WebView.java:1628)
at android.text.util.Linkify.gatherMapLinks(Linkify.java:469)
at android.text.util.Linkify.addLinks(Linkify.java:234)
at android.widget.TextView.setText(TextView.java:3993)
at android.widget.TextView.setText(TextView.java:3915)
at android.widget.TextView.(TextView.java:1315)
at android.widget.TextView.(TextView.java:632)
at android.widget.TextView.(TextView.java:628)
... 52 more
Caused by: java.lang.RuntimeException: Cannot load WebView
at org.chromium.android_webview.AwBrowserProcess.loadLibrary(AwBrowserProcess.java:40)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.initialize(WebViewChromiumFactoryProvider.java:131)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.(WebViewChromiumFactoryProvider.java:100)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:112)
... 61 more
Caused by: org.chromium.base.library_loader.ProcessInitException
at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:271)
at org.chromium.base.library_loader.LibraryLoader.loadNow(LibraryLoader.java:148)
at org.chromium.android_webview.AwBrowserProcess.loadLibrary(AwBrowserProcess.java:34)
... 66 more
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: \"\/data\/app\/com.google.android.webview-2\/lib\/arm\/libwebviewchromium.so\" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:989)
at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:257)
... 68 more
最佳答案
方法1:
在新视图中使用此代码:
TextView t2 = (TextView) findViewById(R.id.text2);
t2.setMovementMethod(LinkMovementMethod.getInstance());
在XML中,只需删除:
android:autoLink="all"
方法2:替换
android:autoLink="all"
具有
android:autoLink="web"