繁体   English   中英

Android中的嵌入式Unity崩溃应用程序

[英]Embedded Unity in Android crashes app

我的android程序中有一个嵌入式Unity3d项目。 3D项目在立体视图中打开,可以在DayDream耳机中使用(尽管它总是说控制器已断开连接,这是一个单独的问题)。 当我单击x退出VR视图时,它会按预期返回到Android应用程序,但在1秒后应用程序翻转到横向和崩溃。

以下是问题的整个堆栈跟踪:

05-02 15:41:08.907 12645-12770/com.example.kshah.unityvrdisabled I/Unity: ApplicationInfo com.example.kshah.unityvrdisabled version 1.0 build c0ed7691-46f7-416e-9b27-1266306bfb38
05-02 15:41:08.993 12645-12770/com.example.kshah.unityvrdisabled E/Unity: Unable to find AudioPluginMsHRTF
05-02 15:41:08.996 12645-12770/com.example.kshah.unityvrdisabled E/Unity: Unable to find AudioPluginOculusSpatializer
05-02 15:41:08.999 12645-12770/com.example.kshah.unityvrdisabled E/Unity: Unable to find libaudioplugingvrunity
05-02 15:41:09.005 12645-12770/com.example.kshah.unityvrdisabled E/Unity: Unable to find libAudioPluginOculusSpatializer
05-02 15:41:09.025 12645-12770/com.example.kshah.unityvrdisabled D/Unity:  GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_border_clamp GL_EXT_multisampled_render_to_texture GL_EXT_mul
    tisampled_render_to_texture2 GL_OES_shader_multisample_interpolation GL_EXT_texture_cube_map_array GL_EXT_draw_buffers_indexed GL_EXT_gpu_shader5 GL_EXT_robustness GL_EXT_texture_buffer GL_EXT_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_OES_texture_storage_multisample_2d_array GL_OES_sample_shading GL_OES_get_program_binary GL_EXT_debug_label GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_QCOM_tiled_rendering GL_ANDROID_extension_pack_es31a GL_EXT_primitive_bounding_box GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_disjoint_timer_query GL_KHR_debug GL_EXT_YUV_target GL_EXT_sRGB_write_control GL_EXT_texture_norm16 GL_EXT_discard_framebuffer GL_OES_surfaceless_context GL_OVR_multiview GL_OVR_multiview2 GL_EXT_texture_sRGB_R8 GL_KHR_no_error GL_EXT_debug_marker GL_OES_EGL_image_external_essl3 GL_OVR_multiview_multisampled_render_to_texture GL_EXT_buffer_storage GL_EXT_external_buffer GL_EXT_blit_framebuffer_params GL_EXT_clip_cull_distance
     GL_EXT_protected_textures GL_EXT_shader_non_constant_global_initializers GL_QCOM_framebuffer_foveated GL_QCOM_shader_framebuffer_fetch_noncoherent GL_EXT_EGL_image_array GL_NV_shader_noperspective_interpolation
    TrackPlayerBase::TrackPlayerBase()
05-02 15:41:09.059 12645-12770/com.example.kshah.unityvrdisabled I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
05-02 15:41:09.059 12645-12770/com.example.kshah.unityvrdisabled W/AudioTrack: notificationFrames=-10 clamped to the range -1 to -8
05-02 15:41:09.060 12645-12770/com.example.kshah.unityvrdisabled I/AudioTrack: AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1536 -> 1536
05-02 15:41:09.060 12645-12770/com.example.kshah.unityvrdisabled D/AudioTrack: Client defaulted notificationFrames to 192 for frameCount 1536
05-02 15:41:09.462 12645-12770/com.example.kshah.unityvrdisabled V/MediaRouter: Adding route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
05-02 15:41:09.467 12645-12770/com.example.kshah.unityvrdisabled V/MediaRouter: Selecting route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
05-02 15:41:09.540 12645-12645/com.example.kshah.unityvrdisabled D/SdkConfigurationReader: Fetched params from VrParamsProvider: allow_dynamic_java_library_loading: true
    allow_dynamic_library_loading: true
    allow_vrcore_compositing: false
    allow_vrcore_head_tracking: false
    async_reprojection_config <
      flags: 0
    >
    cpu_late_latching_enabled: true
    daydream_image_alignment: 3
    dim_ui_layer: true
    disallow_multiview: false
    enable_forced_tracking_compat: false
    screen_capture_config <
      allow_casting: true
    >
    touch_overlay_enabled: false
    use_device_idle_detection: true
    use_direct_mode_sensors: false
    use_magnetometer_in_sensor_fusion: true
    use_online_magnetometer_calibration: true
    use_stationary_bias_correction: true
    use_system_clock_for_sensor_timestamps: false
05-02 15:41:09.568 12645-12645/com.example.kshah.unityvrdisabled W/unityvrdisabled: type=1400 audit(0.0:3103): avc: denied { read } for name="stat" dev="proc" ino=4026532357 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_stat:s0 tclass=file permissive=0
05-02 15:41:09.573 12645-12645/com.example.kshah.unityvrdisabled W/native: commandlineflags.cc:1503 Ignoring RegisterValidateFunction() for flag pointer 0xccbd34d0: no flag found at that address
05-02 15:41:09.596 12645-12645/com.example.kshah.unityvrdisabled I/NativeLibraryLoader: VrCore composition disabled, using in-process compositing fallback.
05-02 15:41:09.600 12645-12645/com.example.kshah.unityvrdisabled I/Ion: [vr/gvr/capi/src/gvr_core_api_loader_android.cc:182] Successfully loaded GVR library version 1.140.0 from VrCore (target was 1.120.0).
05-02 15:41:09.636 12645-12645/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/capi/src/gvr.cc:103] Initialized GVR version 1.140.0
05-02 15:41:09.643 12645-12805/com.example.kshah.unityvrdisabled D/NetworkSecurityConfig: No Network Security Config specified, using platform default
05-02 15:41:09.664 12645-12645/com.example.kshah.unityvrdisabled I/GvrLayoutFactory: Successfully loaded GvrLayout from VrCore.
05-02 15:41:09.669 12645-12645/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:1853] In-process composition enabled for Cardboard
    [vr/gvr/render/scanline_racer.cc:1204] Configuring scanline racer for marlin using custom config.
05-02 15:41:09.686 12645-12645/com.example.kshah.unityvrdisabled E/SdkDaydreamTouchListener: Null deviceParams or no alignment markers found.
05-02 15:41:09.686 12645-12651/com.example.kshah.unityvrdisabled I/zygote: Do partial code cache collection, code=41KB, data=61KB
05-02 15:41:09.688 12645-12651/com.example.kshah.unityvrdisabled I/zygote: After code cache collection, code=41KB, data=61KB
    Increasing code cache capacity to 256KB
05-02 15:41:09.704 12645-12645/com.example.kshah.unityvrdisabled E/SdkDaydreamTouchListener: Null deviceParams or no alignment markers found.
05-02 15:41:09.745 12645-12770/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:500] Creating swap chain with id: [1]
05-02 15:41:09.746 12645-12770/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:504]   BufferSpec 0: Size=V[1807, 2291], ColorFormat=Rgba8888, Samples=0, Views=1
    [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:504]   BufferSpec 1: Size=V[1807, 2291], ColorFormat=Rgba8888, Samples=0, Views=1
    [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:517] Destroying swap chain with id: [1]
05-02 15:41:09.747 12645-12770/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:500] Creating swap chain with id: [4]
    [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:504]   BufferSpec 0: Size=V[1265, 1604], ColorFormat=Rgba8888, Samples=0, Views=1
    [vr/gvr/hmd/cardboard/cardboard_api_impl.cc:504]   BufferSpec 1: Size=V[1265, 1604], ColorFormat=Rgba8888, Samples=0, Views=1
05-02 15:41:09.752 12645-12770/com.example.kshah.unityvrdisabled I/ATRACE: Using __system_property_wait to update tags
05-02 15:41:09.752 12645-12817/com.example.kshah.unityvrdisabled I/ATRACE: Updated trace tags to 4097
05-02 15:41:09.849 12645-12770/com.example.kshah.unityvrdisabled D/AudioTrack: stop() called with 37440 frames delivered
05-02 15:41:10.064 12645-12814/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/render/scanline_racer.cc:333] Scanline racing enabled without context sharing
05-02 15:41:10.075 12645-12770/com.example.kshah.unityvrdisabled I/Unity: Could not recreate VR window because GfxDevice is in an invalid state (device lost)

    (Filename:  Line: 901)
05-02 15:41:10.075 12645-12770/com.example.kshah.unityvrdisabled E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
05-02 15:41:10.078 12645-12814/com.example.kshah.unityvrdisabled I/GVR: [vr/gvr/render/late_latcher.cc:204] Late-latching enabled using EXT_external_buffer.
05-02 15:41:10.131 12645-12645/com.example.kshah.unityvrdisabled V/MediaRouter: onRestoreRoute() : route=RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
    Selecting route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
05-02 15:41:10.211 12645-12814/com.example.kshah.unityvrdisabled W/GVR: [vr/gvr/render/scanline_racer.cc:1374] Missed vsync by 115409us (CPU load is too high)
05-02 15:41:10.262 12645-12770/com.example.kshah.unityvrdisabled E/Unity: Error trying to call delegated method pause. null
05-02 15:41:10.262 12645-12770/com.example.kshah.unityvrdisabled D/AudioTrack: stop() called with 14400 frames delivered
05-02 15:41:10.292 12645-12645/com.example.kshah.unityvrdisabled I/Process: Sending signal. PID: 12645 SIG: 9

应用主屏幕 立体声模式下的统一开启 统一3d项目开放 应用程序崩溃

我的代码附在主要活动下面

public class MainActivity extends AppCompatActivity {

    Button unityVRButton;

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

        unityVRButton = (Button)findViewById(R.id.open_unity);
        unityVRButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,GameActivity.class));
            }
        });
    }
}

呼吁统一的活动

import android.os.Bundle;

import com.rbw.TestVR.UnityPlayerActivity;

/**
 * Created by kshah on 3/15/2018.
 */

public class GameActivity extends UnityPlayerActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}

整个项目可以在此链接中找到

https://drive.google.com/drive/folders/1jFp4pZBMgevB6Z2YgFinYNg6d4KPQJDb?usp=sharing

可能有几个不同的问题。 一个是堆栈跟踪中格式错误的json。

然而,屏幕旋转时的崩溃通常是别的。

似乎有一些任务正在完成对旧视图的引用。 当应用程序切换到横向时,活动将被销毁并重新创建,并重新创建所有视图。 如果长时间运行的进程携带对垃圾收集视图的引用,则您的应用程序将崩溃。

快速判断这是否真的是问题的方法是将其添加到调用活动下的清单中。 这将强制调用活动保持纵向模式。 如果应用程序在退出后没有崩溃,则可能存在一个持有对已销毁视图的引用的进程。

  <activity
android:name=".MyActivity"
android:label="@string/title_my_activity"
android:screenOrientation="portrait" />

以下是更多信息: http//code.hootsuite.com/orientation-changes-on-android/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM