我的 android 程序中有一个嵌入式 Unity3d 项目。 3d 项目在立体 View 中打开良好,可用于 DayDream 耳机(尽管它总是说 Controller 已断开连接,这是一个单独的问题)。当我单击 x 退出 VR View 时,它按预期返回到 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
我的代码附在下面 主要 Activity
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));
}
});
}
}
呼唤团结的 Activity
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。
然而,屏幕旋转时的崩溃通常是另外一回事。
似乎有一些任务正在完成对您旧 View 的引用。当应用程序切换到横向时, Activity 将被销毁并重新创建,并且您的所有 View 都会重新创建。如果长时间运行的进程正在引用被垃圾收集的 View ,您的应用程序将会崩溃。
判断这是否真的是问题的一种快速方法是将其添加到调用 Activity 下的 list 中。这将强制调用 Activity 保持纵向模式。如果应用程序在退出后没有崩溃,那么很可能有一个进程持有对已销毁 View 的引用。
<activity
android:name=".MyActivity"
android:label="@string/title_my_activity"
android:screenOrientation="portrait" />
这里有更多信息: http://code.hootsuite.com/orientation-changes-on-android/
关于android - Android 中的嵌入式 Unity 使应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49860716/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
作为我的Rails应用程序的一部分,我编写了一个小导入程序,它从我们的LDAP系统中吸取数据并将其塞入一个用户表中。不幸的是,与LDAP相关的代码在遍历我们的32K用户时泄漏了大量内存,我一直无法弄清楚如何解决这个问题。这个问题似乎在某种程度上与LDAP库有关,因为当我删除对LDAP内容的调用时,内存使用情况会很好地稳定下来。此外,不断增加的对象是Net::BER::BerIdentifiedString和Net::BER::BerIdentifiedArray,它们都是LDAP库的一部分。当我运行导入时,内存使用量最终达到超过1GB的峰值。如果问题存在,我需要找到一些方法来更正我的代
Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题
我需要从一个View访问多个模型。以前,我的links_controller仅用于提供以不同方式排序的链接资源。现在我想包括一个部分(我假设)显示按分数排序的顶级用户(@users=User.all.sort_by(&:score))我知道我可以将此代码插入每个链接操作并从View访问它,但这似乎不是“ruby方式”,我将需要在不久的将来访问更多模型。这可能会变得很脏,是否有针对这种情况的任何技术?注意事项:我认为我的应用程序正朝着单一格式和动态页面内容的方向发展,本质上是一个典型的网络应用程序。我知道before_filter但考虑到我希望应用程序进入的方向,这似乎很麻烦。最终从任何
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
我在我的项目中添加了一个系统来重置用户密码并通过电子邮件将密码发送给他,以防他忘记密码。昨天它运行良好(当我实现它时)。当我今天尝试启动服务器时,出现以下错误。=>BootingWEBrick=>Rails3.2.1applicationstartingindevelopmentonhttp://0.0.0.0:3000=>Callwith-dtodetach=>Ctrl-CtoshutdownserverExiting/Users/vinayshenoy/.rvm/gems/ruby-1.9.3-p0/gems/actionmailer-3.2.1/lib/action_mailer
我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr