为x86和ARM体系结构嵌入Crosswalk

时间:2016-12-13 11:15:47

标签: android x86 arm crosswalk-runtime crosswalk

我试图将Crosswalk与我的Android应用程序捆绑在一起,以便我可以将其webview包含在Fragment中。业务案例是我们想要在视图上运行的任何HTML都适用于所有Android版本(HTML可能是一个复杂的活动,如游戏)。我正在寻找一个可以管理这个问题的例子,或者我如何改变我的项目以达到这个目的。

我已经按照这里的教程(https://crosswalk-project.org/documentation/android/embedding_crosswalk.html)开始了,这让我可以构建一个APK,正确显示我的Samsung S4上的网页内容,它使用的是ARM芯片组,不过我现在也是想覆盖x86。我有一个模拟器可以测试,但我没有太多运气。我也尝试按照此处的步骤(How to add crosswalk webview in my own android library module?)。

我尝试过以下方法:

  • 包含下载页面上提供的模块的不同排列。
  • 包括ARM和x86库(Android Studio抱怨这些类定义了两次,这是我所期望的。)
  • 复制' x86'来自x86模块中的src / main / jniLibs并将其粘贴到我的应用程序引用的arm模块中。
  • 使用' XWalkActivity' (https://crosswalk-project.org/apis/embeddingapidocs_v7/index.html)不仅在x86上不起作用,而且还停止在我的ARM设备上工作。

我最接近的是这篇文章底部的代码,它允许我在我的模拟器上安装应用程序但不加载Web内容。

我的堆栈轨道中很少有关键事项要注意(在本问题的最后)。

12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkdummy.so': couldn't get XW_Initialize function.
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_extension_server.cc(407)] Failed to initialize extension: /data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkdummy.so
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkcore.so': couldn't get XW_Initialize function.
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_extension_server.cc(407)] Failed to initialize extension: /data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkcore.so

这看起来有问题但是当我在我的ARM设备上运行它并且按预期工作时也会发生这种情况。有谁知道这些是什么及其含义?

12-12 17:09:43.013 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Init embedded mode
12-12 17:09:43.013 12271-12271/com.firstapp.crosswalktest D/XWalkLib: [App Version] build:22.52.561.4, api:7, min_api:7
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: [Lib Version] build:22.52.561.4, api:7, min_api:5
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Crosswalk download mode: false
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: XWalk core version matched
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest I/cr_LibraryLoader: Time to load native libraries: 1 ms (timestamps 144-145)
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest I/cr_LibraryLoader: Expected native library version number "", actual native library version number ""
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Native library is built for IA
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: XWalk core architecture matched
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Running in embedded mode
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Init core bridge

这看起来像是XWalk所经历的设置,请注意' XWalk核心架构匹配&#39 ;;我会从中读到它有它需要的本地库,所以可能还有其他问题吗?

应用程序加载后的堆栈跟踪:

12-12 17:09:39.436 2087-2087/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: Micro detection mode: [mDetectionMode: [1]].
12-12 17:09:39.436 2087-2087/com.google.android.googlequicksearchbox:search I/AudioController: Using mInputStreamFactoryBuilder
12-12 17:09:39.440 2087-12244/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Starting detection.
12-12 17:09:39.440 2087-11832/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.staticplugins.z.c@eee8318
12-12 17:09:39.441 1246-1624/? W/APM_AudioPolicyManager: getInputForAttr() failed opening input: samplingRate 16000, format 1, channelMask 10
12-12 17:09:39.441 2087-11832/com.google.android.googlequicksearchbox:search E/AudioRecord: Could not get audio input for session 265, record source 1999, sample rate 16000, format 0x1, channel mask 0x10, flags 0
12-12 17:09:39.442 2087-11832/com.google.android.googlequicksearchbox:search E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -22.
12-12 17:09:39.442 2087-11832/com.google.android.googlequicksearchbox:search E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
12-12 17:09:39.442 2087-11832/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.staticplugins.z.c@eee8318
12-12 17:09:39.443 2087-11832/com.google.android.googlequicksearchbox:search E/ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
12-12 17:09:39.445 2087-2087/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: onReady
12-12 17:09:39.447 2087-12244/com.google.android.googlequicksearchbox:search W/SpeechLevelGenerator: Really low audio levels detected. The audio input may have issues.
12-12 17:09:39.453 2087-11832/com.google.android.googlequicksearchbox:search I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.staticplugins.z.c@eee8318
12-12 17:09:39.453 2087-12244/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Detection finished
12-12 17:09:39.454 2087-12244/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
12-12 17:09:39.455 2087-2242/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Stopping hotword detection.
12-12 17:09:39.455 2087-12244/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
       com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
           at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
           at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
           at java.util.concurrent.FutureTask.run(FutureTask.java:237)
           at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
           at java.lang.Thread.run(Thread.java:761)
           at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
        Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
           at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
           at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
           at java.io.InputStream.read(InputStream.java:101)
           at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
           at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
           at java.util.concurrent.FutureTask.run(FutureTask.java:237)
           at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
           at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
           at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
           at java.lang.Thread.run(Thread.java:761) 
           at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 
12-12 17:09:39.455 2087-12244/com.google.android.googlequicksearchbox:search I/AudioController: internalShutdown
12-12 17:09:39.457 2087-2087/com.google.android.googlequicksearchbox:search I/MicroDetector: Keeping mic open: false
12-12 17:09:39.457 2087-2087/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: #onError(false)
12-12 17:09:39.457 2087-12243/com.google.android.googlequicksearchbox:search I/DeviceStateChecker: DeviceStateChecker cancelled
12-12 17:09:42.710 12251-12251/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
12-12 17:09:42.711 12251-12251/? D/AndroidRuntime: CheckJNI is ON
12-12 17:09:42.711 12251-12251/? E/cutils-trace: Error opening trace file: Permission denied (13)
12-12 17:09:42.736 12251-12251/? W/art: Unexpected CPU variant for X86 using defaults: x86
12-12 17:09:42.739 12251-12251/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-12 17:09:42.745 12255-12255/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
12-12 17:09:42.746 12255-12255/? D/AndroidRuntime: CheckJNI is ON
12-12 17:09:42.746 12255-12255/? E/cutils-trace: Error opening trace file: Permission denied (13)
12-12 17:09:42.748 12251-12251/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-12 17:09:42.748 12251-12251/? E/android.os.Debug: failed to load memtrack module: -2
12-12 17:09:42.749 12251-12251/? I/Radio-JNI: register_android_hardware_Radio DONE
12-12 17:09:42.758 12251-12251/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm
12-12 17:09:42.759 12251-12251/? D/AndroidRuntime: Shutting down VM
12-12 17:09:42.761 12251-12262/? W/art: Thread attaching while runtime is shutting down: Binder:12251_1
12-12 17:09:42.761 12251-12262/? I/AndroidRuntime: NOTE: attach of thread 'Binder:12251_1' failed
12-12 17:09:42.776 12255-12255/? W/art: Unexpected CPU variant for X86 using defaults: x86
12-12 17:09:42.780 12255-12255/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-12 17:09:42.793 12255-12255/? E/memtrack: Couldn't load memtrack module (No such file or directory)
12-12 17:09:42.793 12255-12255/? E/android.os.Debug: failed to load memtrack module: -2
12-12 17:09:42.794 12255-12255/? I/Radio-JNI: register_android_hardware_Radio DONE
12-12 17:09:42.799 12255-12255/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am
12-12 17:09:42.803 1461-1914/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.firstapp.crosswalktest/.MainActivity} from uid 2000 on display 0
12-12 17:09:42.811 12255-12255/? D/AndroidRuntime: Shutting down VM
12-12 17:09:42.815 12271-12271/? I/art: Not late-enabling -Xcheck:jni (already on)
12-12 17:09:42.816 12271-12271/? W/art: Unexpected CPU variant for X86 using defaults: x86
12-12 17:09:42.822 1461-1476/system_process I/ActivityManager: Start proc 12271:com.firstapp.crosswalktest/u0a76 for activity com.firstapp.crosswalktest/.MainActivity
12-12 17:09:42.943 1461-1476/system_process W/art: Long monitor contention with owner android.display (1509) at int com.android.server.wm.WindowManagerService.relayoutWindow(com.android.server.wm.Session, android.view.IWindow, int, android.view.WindowManager$LayoutParams, int, int, int, int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect, android.content.res.Configuration, android.view.Surface)(WindowManagerService.java:2850) waiters=0 in void com.android.server.wm.WindowManagerService.resumeKeyDispatching(android.os.IBinder) for 120ms
12-12 17:09:42.944 1461-1495/system_process W/art: Long monitor contention with owner Binder:1461_2 (1476) at void com.android.server.am.ActivityManagerService.activityPaused(android.os.IBinder)(ActivityManagerService.java:6915) waiters=0 in void com.android.server.am.ActivityManagerService.dispatchUidsChanged() for 132ms
12-12 17:09:42.958 2087-2087/com.google.android.googlequicksearchbox:search W/SearchService: Abort, client detached.
12-12 17:09:43.013 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Init embedded mode
12-12 17:09:43.013 12271-12271/com.firstapp.crosswalktest D/XWalkLib: [App Version] build:22.52.561.4, api:7, min_api:7
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: [Lib Version] build:22.52.561.4, api:7, min_api:5
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Crosswalk download mode: false
12-12 17:09:43.014 12271-12271/com.firstapp.crosswalktest D/XWalkLib: XWalk core version matched
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest I/cr_LibraryLoader: Time to load native libraries: 1 ms (timestamps 144-145)
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest I/cr_LibraryLoader: Expected native library version number "", actual native library version number ""
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Native library is built for IA
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: XWalk core architecture matched
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Running in embedded mode
12-12 17:09:43.045 12271-12271/com.firstapp.crosswalktest D/XWalkLib: Init core bridge
12-12 17:09:43.057 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.ButtonCompat is not int.
12-12 17:09:43.057 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.TextViewWithLeading is not int.
12-12 17:09:43.066 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.ButtonCompat is not int.
12-12 17:09:43.066 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.TextViewWithLeading is not int.
12-12 17:09:43.069 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.ButtonCompat is not int.
12-12 17:09:43.069 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.TextViewWithLeading is not int.
12-12 17:09:43.076 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.ButtonCompat is not int.
12-12 17:09:43.076 12271-12271/com.firstapp.crosswalktest W/XWalkInternalResources: org.xwalk.core.R$styleable.TextViewWithLeading is not int.
12-12 17:09:43.082 12271-12271/com.firstapp.crosswalktest I/cr_LibraryLoader: Expected native library version number "", actual native library version number ""
12-12 17:09:43.082 12271-12271/com.firstapp.crosswalktest I/chromium: [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
12-12 17:09:43.084 12271-12271/com.firstapp.crosswalktest I/cr_BrowserStartup: Initializing chromium process, singleProcess=true

                                   [ 12-12 17:09:43.098 12271:12271 D/         ]
                                   HostConnection::get() New Host Connection established 0x9b4409a0, tid 12271
12-12 17:09:43.150 12271-12300/com.firstapp.crosswalktest W/cr_media: Requires BLUETOOTH permission
12-12 17:09:43.153 12271-12271/com.firstapp.crosswalktest E/chromium: [ERROR:xwalk_platform_notification_service.cc(143)] Not implemented reached in virtual bool xwalk::XWalkPlatformNotificationService::GetDisplayedPersistentNotifications(content::BrowserContext*, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >*)
12-12 17:09:43.167 12271-12271/com.firstapp.crosswalktest E/chromium: [ERROR:xwalk_browser_context.cc(87)] Failed to read preference, error num: 0
12-12 17:09:43.168 12271-12271/com.firstapp.crosswalktest D/XWalkContent: CompositingSurfaceType is SurfaceView
12-12 17:09:43.209 12271-12271/com.firstapp.crosswalktest W/art: Attempt to remove non-JNI local reference, dumping thread
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkdummy.so': couldn't get XW_Initialize function.
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_extension_server.cc(407)] Failed to initialize extension: /data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkdummy.so
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkcore.so': couldn't get XW_Initialize function.
12-12 17:09:43.243 12271-12294/com.firstapp.crosswalktest W/chromium: [WARNING:xwalk_extension_server.cc(407)] Failed to initialize extension: /data/app/com.firstapp.crosswalktest-2/lib/x86/libxwalkcore.so
12-12 17:09:43.267 12271-12271/com.firstapp.crosswalktest I/cr_Ime: ImeThread is not enabled.
12-12 17:09:43.282 12271-12318/com.firstapp.crosswalktest I/chromium: [INFO:xwalk_extension_renderer_controller.cc(42)] EXTENSION PROCESS DISABLED.
12-12 17:09:43.301 12271-12323/com.firstapp.crosswalktest E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
12-12 17:09:43.320 12271-12323/com.firstapp.crosswalktest I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es

                                   [ 12-12 17:09:43.326 12271:12323 D/         ]
                                   HostConnection::get() New Host Connection established 0xa8b89800, tid 12323
12-12 17:09:43.333 1228-1268/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
12-12 17:09:43.487 12271-12326/com.firstapp.crosswalktest I/OpenGLRenderer: Initialized EGL, version 1.4
12-12 17:09:43.487 12271-12326/com.firstapp.crosswalktest D/OpenGLRenderer: Swap behavior 1

                                    [ 12-12 17:09:43.488 12271:12326 D/         ]
                                    HostConnection::get() New Host Connection established 0x87a05940, tid 12326
12-12 17:09:43.562 12271-12271/com.firstapp.crosswalktest W/art: Attempt to remove non-JNI local reference, dumping thread
12-12 17:09:43.958 1461-1509/system_process I/ActivityManager: Displayed com.firstapp.crosswalktest/.MainActivity: +1s147ms
12-12 17:09:43.994 12271-12271/com.firstapp.crosswalktest E/chromium: [ERROR:layer_tree_host_impl.cc(2233)] Forcing zero-copy tile initialization as worker context is missing
12-12 17:09:44.093 12271-12271/com.firstapp.crosswalktest W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 12271
12-12 17:09:44.102 12271-12323/com.firstapp.crosswalktest E/chromium: [ERROR:buffer_manager.cc(438)] [.DisplayCompositor-0x84d23400]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
12-12 17:09:44.352 1228-1228/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
12-12 17:09:44.640 12271-12323/com.firstapp.crosswalktest E/chromium: [ERROR:texture_manager.cc(2942)] [.RenderCompositor-0x88b75800]GL ERROR :GL_INVALID_OPERATION : glTexImage2D: <- error from previous GL command
12-12 17:09:45.247 12271-12291/com.firstapp.crosswalktest D/NetworkSecurityConfig: No Network Security Config specified, using platform default

我的项目结构:

Project Structure

MainActivity.java

package com.firstapp.crosswalktest;

import org.xwalk.core.XWalkPreferences;
import org.xwalk.core.XWalkView;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    private XWalkView mXWalkView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);

        mXWalkView = (XWalkView) findViewById(R.id.activity_main);
        mXWalkView.load("http://crosswalk-project.org/", null);
    }
}

activity_main.xml中

<org.xwalk.core.XWalkView android:id="@+id/activity_main"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
</org.xwalk.core.XWalkView>

0 个答案:

没有答案