Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility Fixes for Unity 2021 and Above in Flutter Unity Widget Plugin #903

Open
mr-aydemir opened this issue Dec 7, 2023 · 6 comments
Labels
Documentation Documentation issue (readme or examples)

Comments

@mr-aydemir
Copy link

mr-aydemir commented Dec 7, 2023

Solutions Implemented for Compatibility with Unity 2021 and Higher Versions:

  1. Issue: Execution failed for task ':unityLibrary:BuildIl2CppTask'.

    • Error: NDK is not installed

    Solution: In the unityLibrary/build.gradle file, comment out the following line:

    android {
        //ndkPath "C:/Program Files/Unity/Hub/Editor/2022.3.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK"
    ...
    }
  2. Issue: NoSuchFieldError - No "Ljava/lang/Object;" field "mUnityPlayer" in class "Lcom/example/app/MainActivity;" or its superclasses.
    Solution: Refer to the comment in this GitHub issue for a potential fix: Flutter Unity Widget Issue #836 Comment

  3. Issue: E/AndroidRuntime(14114): java.lang.NoSuchMethodError: no non-static method "Lcom/xraph/plugin/flutter_unity_widget/CustomUnityPlayer;.hidePreservedContent()V"

    Solution: In the library directory flutter-unity-view-widget, modify the file flutter-unity-view-widget\android\src\main\kotlin\com\xraph\plugin\flutter_unity_widget\CustomUnityPlayer.kt by adding the following method to the CustomUnityPlayer class:

    @SuppressLint("NewApi")
    class CustomUnityPlayer(context: Activity, upl: IUnityPlayerLifecycleEvents?) : UnityPlayer(context, upl) {
    
        companion object {
            internal const val LOG_TAG = "CustomUnityPlayer"
        }
    
        // Add this method
        fun hidePreservedContent() {
            // Implement content hiding logic here
            // Example:
            // this.setVisibility(View.GONE);
        }    
    ...
    }
  4. If Unity is still not displayed after the above steps:

    • In Flutter, set the useAndroidViewSurface parameter to true in your UnityWidget widget:
    UnityWidget(
      useAndroidViewSurface: true,
      // Other parameters...
    )

These solutions are intended to address compatibility issues encountered with Unity 2021 and higher versions when integrating with the Flutter Unity Widget plugin.

@mr-aydemir mr-aydemir changed the title Solution for new Unity Version Compatibility Fixes for Unity 2021 and Above in Flutter Unity Widget Plugin Dec 7, 2023
@timbotimbo timbotimbo added the Documentation Documentation issue (readme or examples) label Jan 1, 2024
@timbotimbo
Copy link
Collaborator

  1. Was handled here Remove ndkPath from generated build.gradle #880 (not yet in a unitypackage).

  2. I've got a pull request open for this one [Android] Fix Unity plugins using the AndroidJavaProxy. (mUnityPlayer error) #908 .

  3. Can you give any context to when/how you get this error?
    I haven't seen it yet and google only gets me to this issue.

  4. Is a flutter bug that seems to have gotten worse with recent Unity/ Flutter versions, I will need to look more into this.

@mr-aydemir
Copy link
Author

mr-aydemir commented Jan 3, 2024

1-2. Thank you for response :),
2. I will check it.
4. Unfortunately, there is such a problem.

  1. I get this error when opening the screen with Unity widget in Flutter application. The log is like this:
Launching lib\main.dart on RNE L01 in debug mode...
E:\makertech\android\unityLibrary\src\main\Il2CppOutputProject\IL2CPP\build\deploy\il2cpp.exe --compile-cpp --platform=Android --architecture=arm64 --outputpath=E:/makertech/android/unityLibrary/src/main/jniLibs/arm64-v8a/libil2cpp.so --baselib-directory=E:/makertech/android/unityLibrary/src/main/jniStaticLibs/arm64-v8a --configuration=Release --dotnetprofile=unityaot-linux --profiler-report --profiler-output-file=E:/makertech/android/unityLibrary/build/il2cpp_arm64-v8a_Release/il2cpp_conv.traceevents --print-command-line --data-folder=E:/makertech/android/unityLibrary/src/main/Il2CppOutputProject/Source/il2cppOutput/data --generatedcppdir=E:/makertech/android/unityLibrary/src/main/Il2CppOutputProject/Source/il2cppOutput --cachedirectory=E:/makertech/android/unityLibrary/build/il2cpp_arm64-v8a_Release/il2cpp_cache --tool-chain-path=C:\Program Files\Unity\Hub\Editor\2022.3.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK
Starting: E:\makertech\android\unityLibrary\src\main\Il2CppOutputProject\IL2CPP\build\deploy\bee_backend\win-x64\bee_backend.exe --verbose --threads=12 --profile="E:/makertech/android/unityLibrary/build/il2cpp_arm64-v8a_Release/il2cpp_cache/buildstate/backend_profiler0.traceevents" --beedriver-listener --dagfile="E:/makertech/android/unityLibrary/build/il2cpp_arm64-v8a_Release/il2cpp_cache/buildstate/bee.dag" --continue-on-failure FinalProgram
WorkingDir: E:/makertech/android/unityLibrary/build/il2cpp_arm64-v8a_Release/il2cpp_cache/buildstate
ExitCode: 0 Duration: 4s547ms
Build succeeded with 2 successful nodes and 0 failed ones

Running Gradle task 'assembleDebug'...                             85,9s
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...          75,7s
Syncing files to device RNE L01...                                 168ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on RNE L01 is available at: http://127.0.0.1:60636/Pq2la7kpQ3g=/
E/BufferQueueProducer( 4027): [] Can not get hwsched service
I/ExoPlayerImpl( 4027): Init 91550e1 [ExoPlayerLib/2.18.7] [HWRNE, RNE-L01, HUAWEI, 26]
W/Settings( 4027): mValues not put! needsGenerationTracker: true currentGeneration: -1 name: accessibility_captioning_enabled value: 0
I/HwCust  ( 4027): Constructor found for class android.net.HwCustConnectivityManagerImpl
D/HwCust  ( 4027): Create obj success use class android.net.HwCustConnectivityManagerImpl
D/NetworkSecurityConfig( 4027): No Network Security Config specified, using platform default
W/VideoCapabilities( 4027): Unrecognized profile/level 1/32 for video/mp4v-es
I/VideoCapabilities( 4027): Unsupported profile 16384 for video/mp4v-es
I/VideoCapabilities( 4027): Unsupported profile 16384 for video/mp4v-es
W/VideoCapabilities( 4027): Unsupported mime video/x-pn-realvideo
W/VideoCapabilities( 4027): Unsupported mime video/mpeg
W/VideoCapabilities( 4027): Unrecognized profile/level 0/0 for video/mpeg2
W/VideoCapabilities( 4027): Unrecognized profile/level 0/2 for video/mpeg2
W/VideoCapabilities( 4027): Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities( 4027): Unrecognized profile/level 32768/2 for video/mp4v-es
W/VideoCapabilities( 4027): Unsupported mime video/vc1
I/VideoCapabilities( 4027): Unsupported profile 4 for video/mp4v-es
I/OMXClient( 4027): Treble IOmx obtained
I/ACodec  ( 4027): In onAllocateComponent create compenent, codec name: OMX.IMG.MSVDX.Decoder.AVC
D/SurfaceUtils( 4027): connecting to surface 0x7977c20010, reason connectToSurface
I/MediaCodec( 4027): [OMX.IMG.MSVDX.Decoder.AVC] setting surface generation to 4123649
D/SurfaceUtils( 4027): disconnecting from surface 0x7977c20010, reason connectToSurface(reconnect)
D/SurfaceUtils( 4027): connecting to surface 0x7977c20010, reason connectToSurface(reconnect)
W/HwExtendedUtils( 4027): hw configLocalPlayBack err = -1010
E/ACodec  ( 4027): [OMX.IMG.MSVDX.Decoder.AVC] setPortMode on output to DynamicANWBuffer failed w/ err -1010
W/ACodec  ( 4027): [OMX.IMG.MSVDX.Decoder.AVC] prepareForAdaptivePlayback failed w/ err -1010
I/HwExtendedCodec( 4027): mime is [video/avc] at setVideoFormat
I/ACodec  ( 4027): codec does not support config priority (err -1010)
I/ACodec  ( 4027): onStart
V/ActivityThread( 4027): Handle window ActivityRecord{f7e393d token=android.os.BinderProxy@a1d9c6e {com.example.makertech/com.example.makertech.MainActivity}} visibility: true
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
I/HwExtendedUtils( 4027): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils( 4027): disconnecting from surface 0x7977c20010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils( 4027): connecting to surface 0x7977c20010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils( 4027): set up nativeWindow 0x7977c20010 for 1280x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
E/BpSurfaceComposerClient( 4027): Failed to transact (-1)
E/BpSurfaceComposerClient( 4027): Failed to transact (-1)
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
I/OMXClient( 4027): Treble IOmx obtained
W/InputMethodManager( 4027): startInputReason = 1
The Flutter DevTools debugger and profiler on RNE L01 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:60636/Pq2la7kpQ3g=/
I/ACodec  ( 4027): In onAllocateComponent create compenent, codec name: OMX.google.aac.decoder
W/HwExtendedUtils( 4027): hw configLocalPlayBack err = -2147483648
I/ACodec  ( 4027): codec does not support config priority (err -2147483648)
I/ACodec  ( 4027): codec does not support config operating rate (err -2147483648)
I/ACodec  ( 4027): onStart
I/HwExtendedUtils( 4027): error setConfig queuesToNativeWindow (err -1010)
D/SurfaceUtils( 4027): disconnecting from surface 0x7977c20010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils( 4027): connecting to surface 0x7977c20010, reason setNativeWindowSizeFormatAndUsage
D/SurfaceUtils( 4027): set up nativeWindow 0x7977c20010 for 1280x720, color 0x300, rotation 0, usage 0x20002900
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2000
I/zygote64( 4027): Do full code cache collection, code=113KB, data=111KB
I/zygote64( 4027): After code cache collection, code=99KB, data=75KB
D/AudioTrack( 4027): OFFLOAD 0,mNotificationFrames 0,mStreamType =-1,mOriginalSampleRate 48000,mAfSampleRate 48000,mTransfer 3
D/AudioTrack( 4027): Client defaulted notificationFrames to 6000 for frameCount 12000
I/AudioTrack( 4027): audioTrack send start state to pg
W/InputMethodManager( 4027): startInputReason = 5
I/hwaps   ( 4027): JNI_OnLoad
V/AudioManager( 4027): playSoundEffect   effectType: 0
V/AudioManager( 4027): playSoundEffect   effectType: 0
I/IL2CPP  ( 4027): JNI_OnLoad
D/FlutterUnityController( 4027): Attaching unity to view
I/Unity   ( 4027): MemoryManager: Using 'Dynamic Heap' Allocator.
I/Unity   ( 4027): SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 3788mb
I/Unity   ( 4027): SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf0), 4 little (mask: 0xf)
I/Unity   ( 4027): ApplicationInfo com.example.makertech version 0.1.0
I/Unity   ( 4027): Built from '2022.3/staging' branch, Version '2022.3.14f1 (eff2de9070d8)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Enabled'        
I/Unity   ( 4027): Company Name: DefaultCompany
I/Unity   ( 4027): Product Name: MakertechUnity
D/Unity   ( 4027):  GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_texture_compression_astc_sliced_3d GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_
D/Unity   ( 4027): to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storage GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness GL_EXT_draw_buffers_indexed GL_OES_draw_buffers_indexed GL_EXT_texture_border_clamp GL_OES_texture_border_clamp GL_EXT_texture_cube_map_array GL_OES_texture_cube_map_array GL_OES_sample_variables GL_OES_sample_shading GL_OES_shader_multisample_interpolation GL_EXT_shader_io_blocks GL_OES_shader_io_blocks GL_EXT_tessellation_shader GL_OES_tessellation_shader GL_EXT_primitive_bounding_box GL_OES_primitive_bounding_box GL_EXT_geometry_shader GL_OES_geometry_shader GL_ANDROID_extension_pack_es31a GL_EXT_gpu_shader5 GL_OES_gpu_shader5 GL_EXT_texture
D/Unity   ( 4027): _buffer GL_OES_texture_buffer GL_EXT_copy_image GL_OES_copy_image GL_EXT_shader_non_constant_global_initializers GL_EXT_color_buffer_half_float GL_EXT_color_buffer_float GL_EXT_YUV_target GL_OVR_multiview GL_OVR_multiview2 GL_OVR_multiview_multisampled_render_to_texture GL_KHR_robustness GL_KHR_robust_buffer_access_behavior GL_EXT_draw_elements_base_vertex GL_OES_draw_elements_base_vertex GL_EXT_protected_textures
E/libEGL  ( 4027): eglGetFrameTimestampSupportedANDROID:2676 error 300d (EGL_BAD_SURFACE)
I/AudioSystem-JNI( 4027): listAudioPorts AudioSystem::listAudioPorts numPorts 7 generation 125 generation1 125
V/AudioManager( 4027): getProperty  key: android.media.property.OUTPUT_FRAMES_PER_BUFFER
V/AudioManager( 4027): getProperty  key: android.media.property.OUTPUT_SAMPLE_RATE
V/AudioManager( 4027): getProperty  key: android.media.property.OUTPUT_FRAMES_PER_BUFFER
D/AudioTrack( 4027): OFFLOAD 0,mNotificationFrames 0,mStreamType =-1,mOriginalSampleRate 24000,mAfSampleRate 48000,mTransfer 3
D/AudioTrack( 4027): Client defaulted notificationFrames to 682 for frameCount 2048
D/android.media.AudioTrack( 4027): [HSM] AudioTrace play() uid: 10223, pid: 4027
W/Unity   ( 4027): The referenced script (Unknown) on this Behaviour is missing!
W/Unity   ( 4027): The referenced script on this Behaviour (Game Object '<null>') is missing!
I/AudioTrack( 4027): audioTrack continuously zero data counter >= 20, send pause/stop state to pg, counter: 20
I/IL2CPP  ( 4027): Locale tr-TR
D/AudioTrack( 4027): stop() called with 24576 frames delivered
D/android.media.AudioTrack( 4027): [HSM] AudioTrace stop() uid: 10223, pid: 4027
V/MediaRouter( 4027): Adding route: RouteInfo{ name=Telefon, description=null, status=null, category=RouteCategory{ name=Sistem types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
V/MediaRouter( 4027): Selecting route: RouteInfo{ name=Telefon, description=null, status=null, category=RouteCategory{ name=Sistem types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO  groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
D/FlutterUnityController( 4027): onCreate
D/FlutterUnityController( 4027): onResume
I/PlatformViewsController( 4027): Using hybrid composition for platform view: 0
I/Choreographer( 4027): Skipped 122 frames!  The application may be doing too much work on its main thread.
W/libEGL  ( 4027): EGLNativeWindowType 0x795affe010 disconnect failed
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
W/libEGL  ( 4027): EGLNativeWindowType 0x795affe010 disconnect failed
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
E/BufferQueueProducer( 4027): [] Can not get hwsched service
W/libEGL  ( 4027): EGLNativeWindowType 0x795affe010 disconnect failed
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
I/CustomUnityPlayer( 4027): onAttachedToWindow
E/BufferQueueProducer( 4027): [] Can not get hwsched service
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/mali_winsys( 4027): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
I/AR      ( 4027): 2024-01-03 13:04:56: Creating Vuforia Engine instance...
D/AR      ( 4027): Found and imported ARCore library.
D/AR      ( 4027): ARCore version installed on device: unknown
D/AR      ( 4027): ARCore library built into app: f3ba394ebe6d3c542ee11e6cabaec8af
I/CameraManagerGlobal( 4027): Connecting to camera service
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 0
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 1
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/AR      ( 4027): 2024-01-03 13:04:56: Required permissions have been granted
I/AR      ( 4027): 2024-01-03 13:04:56: Vuforia build version: 10.19.3+1017
D/AR      ( 4027): ARCore is not available to Vuforia, it reports that an availability check is pending.
I/Camera  ( 4027): camera number: 2
I/Camera  ( 4027): camera number: 2
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 1 line
I/Camera  ( 4027): camera number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 3 lines
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 3 lines
I/Camera  ( 4027): camera number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 1 line
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/ARCore-InstallService( 4027): Install service connected
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 3 lines
I/Camera  ( 4027): camera number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 3 lines
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 11 lines
I/Camera  ( 4027): camera number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 11 lines
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 11 lines
I/Camera  ( 4027): camera number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/AR      ( 4027): Creating Vuforia Engine instance...SUCCESS
I/AR      ( 4027): Creating DevicePoseObserver...
I/AR      ( 4027): Created new observer with ID '1'
I/AR      ( 4027): Creating DevicePoseObserver...SUCCESS
I/AR      ( 4027): Creating IlluminationObserver...
I/AR      ( 4027): Auto-activating observer...
I/AR      ( 4027): Activated observer with ID '2'
I/AR      ( 4027): Auto-activating observer...DONE
I/AR      ( 4027): Created new observer with ID '2'
I/AR      ( 4027): Creating IlluminationObserver...SUCCESS
I/Unity   ( 4027): Vuforia Initialized
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:InitOnCameraReady()
I/Unity   ( 4027): Vuforia.Internal.ExternalCamera.NullExternalCamera:Init(Func`1)
I/Unity   ( 4027): Vuforia.Internal.Permissions.PermissionCallbacksAndroid:TryInvokeCallback()
I/Unity   ( 4027): Vuforia.Internal.Permissions.PermissionCallbacksAndroid:OnPermissionGranted(String)
I/Unity   ( 4027): Vuforia.Internal.Utility.ExtensionMethods.IEnumerableExtensionMethods:ForEach(IEnumerable`1, Action`1)
I/Unity   ( 4027): Vuforia.Internal.Core.EnginePermissions:RequestPermissions()
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Init(String)
I/Unity   ( 4027): Vuforia.Internal.Core.OneTimeInitialization:Initialize()
I/Unity   ( 4027):
I/AR      ( 4027): Activating observer...
I/AR      ( 4027): Activated observer with ID '1'
I/AR      ( 4027): Activating observer...SUCCESS
I/AR      ( 4027): Starting Vuforia Engine instance...
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 1 line
I/Camera  ( 4027): camera number: 2
E/ARCore-InstallService( 4027): The device is not supported.
I/PermissionManager( 4027): camera remind result:true
I/Camera  ( 4027): open camera: 0, package name: com.example.makertech
I/HwSystemManager( 4027): pkgName = com.example.makertech pid = 4027uidOf3RdApk = 10223permType = 0permCfg=1
I/BackgroundPermManager( 4027): pkgName: com.example.makertech,pid: 4027 ,uidOf3RdApk: 10223 ,permType: 0 ,permCfg: 1
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
E/BufferQueueProducer( 4027): [] Can not get hwsched service
E/BufferQueueProducer( 4027): [] Can not get hwsched service
I/AR      ( 4027): Starting camera with profile for RNE-L01, 0
I/AR      ( 4027): Starting Vuforia Engine instance...SUCCESS
E/Unity   ( 4027): Unknown screen orientation received! Assuming it is Landscape Left.
E/Unity   ( 4027): Vuforia.RuntimeExtensionMethods:ToVuforiaScreenOrientation(ScreenOrientation)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
E/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
E/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:add_OnAfterVuforiaInitializedPublic(Action`1)
E/Unity   ( 4027): Vuforia.VuforiaBehaviour:Awake()
E/Unity   ( 4027):
E/AR      ( 4027): The device orientation does not match the provided view orientation '1'
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
E/Unity   ( 4027): Could not set view orientation to LANDSCAPE_LEFT
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:SetupRenderController(VuViewOrientation)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
E/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
E/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:add_OnAfterVuforiaInitializedPublic(Action`1)
E/Unity   ( 4027): Vuforia.VuforiaBehaviour:Awake()
E/Unity   ( 4027):
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/Unity   ( 4027): Creating dataset: Vuforia/ArduinoUnoR3.xml/AssemblyArduinoUnoR3
I/Unity   ( 4027): Vuforia.ModelTargetBehaviour:CreateObserverFromDataset(IObserverFactory)
I/Unity   ( 4027): Vuforia.ModelTargetBehaviour:OnVuforiaStarted()
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:OnStart()
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:add_OnAfterVuforiaInitializedPublic(Action`1)
I/Unity   ( 4027): Vuforia.VuforiaBehaviour:Awake()
I/Unity   ( 4027):
I/AR      ( 4027): Creating ModelTargetObserver...
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/zygote64( 4027): Do partial code cache collection, code=122KB, data=96KB
I/zygote64( 4027): After code cache collection, code=122KB, data=96KB
I/zygote64( 4027): Increasing code cache capacity to 512KB
I/zygote64( 4027): Background concurrent copying GC freed 62586(3MB) AllocSpace objects, 6(4MB) LOS objects, 50% free, 18MB/37MB, paused 20.118ms total 105.089ms
I/AR      ( 4027): Created new observer with ID '3'
I/AR      ( 4027): Creating ModelTargetObserver...SUCCESS
I/AR      ( 4027): Activating observer...
I/AR      ( 4027): Activated observer with ID '3'
I/AR      ( 4027): Activating observer...SUCCESS
I/Unity   ( 4027): Vuforia Started
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:add_OnAfterVuforiaInitializedPublic(Action`1)
I/Unity   ( 4027): Vuforia.VuforiaBehaviour:Awake()
I/Unity   ( 4027):
I/AR      ( 4027): Stopping Vuforia Engine instance...
I/Camera  ( 4027): close camera: 0, package name: com.example.makertech
I/HwSystemManager( 4027): pkgName = com.example.makertech pid = 4027uidOf3RdApk = 10223permType = 0permCfg=0
I/BackgroundPermManager( 4027): pkgName: com.example.makertech,pid: 4027 ,uidOf3RdApk: 10223 ,permType: 0 ,permCfg: 0
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/AR      ( 4027): Stopping Vuforia Engine instance...SUCCESS
I/Unity   ( 4027): Vuforia Stopped
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Stop(Action)
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Pause()
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
I/Unity   ( 4027): Vuforia.Internal.Core.UnityLifeCycleListener:OnApplicationPause(Boolean)
I/Unity   ( 4027):
I/AR      ( 4027): Starting Vuforia Engine instance...
I/Camera  ( 4027): camera number: 2
I/chatty  ( 4027): uid=10223(u0_a223) UnityMain identical 1 line
I/Camera  ( 4027): camera number: 2
I/PermissionManager( 4027): camera remind result:true
I/Camera  ( 4027): open camera: 0, package name: com.example.makertech
I/HwSystemManager( 4027): pkgName = com.example.makertech pid = 4027uidOf3RdApk = 10223permType = 0permCfg=1
I/BackgroundPermManager( 4027): pkgName: com.example.makertech,pid: 4027 ,uidOf3RdApk: 10223 ,permType: 0 ,permCfg: 1
D/AudioTrack( 4027): OFFLOAD 0,mNotificationFrames 0,mStreamType =-1,mOriginalSampleRate 24000,mAfSampleRate 48000,mTransfer 3
D/AudioTrack( 4027): Client defaulted notificationFrames to 682 for frameCount 2048
D/android.media.AudioTrack( 4027): [HSM] AudioTrace play() uid: 10223, pid: 4027
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
I/CameraManagerGlobal( 4027): do not need hide aux camera, device number: 2
E/BufferQueueProducer( 4027): [] Can not get hwsched service
E/BufferQueueProducer( 4027): [] Can not get hwsched service
I/AR      ( 4027): Starting camera with profile for RNE-L01, 0
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/AR      ( 4027): Starting Vuforia Engine instance...SUCCESS
E/Unity   ( 4027): Unknown screen orientation received! Assuming it is Landscape Left.
E/Unity   ( 4027): Vuforia.RuntimeExtensionMethods:ToVuforiaScreenOrientation(ScreenOrientation)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Resume()
E/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
E/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
E/Unity   ( 4027): Vuforia.Internal.Core.UnityLifeCycleListener:OnApplicationPause(Boolean)
E/Unity   ( 4027):
E/AR      ( 4027): The device orientation does not match the provided view orientation '1'
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
E/Unity   ( 4027): Could not set view orientation to LANDSCAPE_LEFT
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:SetupRenderController(VuViewOrientation)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
E/Unity   ( 4027): Vuforia.Internal.Core.Engine:Resume()
E/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
E/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
E/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
E/Unity   ( 4027): Vuforia.Internal.Core.UnityLifeCycleListener:OnApplicationPause(Boolean)
E/Unity   ( 4027):
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/Unity   ( 4027): Vuforia Started
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Start(Action)
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:Resume()
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`1, T)
I/Unity   ( 4027): Vuforia.Internal.Core.UnityLifeCycleListener:OnApplicationPause(Boolean)
I/Unity   ( 4027):
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/Unity   ( 4027): Target status: AssemblyArduinoUnoR3 NO_POSE -- NOT_OBSERVED
I/Unity   ( 4027): DefaultObserverEventHandler:OnObserverStatusChanged(ObserverBehaviour, TargetStatus)
I/Unity   ( 4027): DefaultObserverEventHandler:Start()
I/Unity   ( 4027):
I/AudioTrack( 4027): audioTrack continuously zero data counter >= 20, send pause/stop state to pg, counter: 20
W/GrallocMapperPassthrough( 4027): buffer descriptor with invalid usage bits 0x2080000
I/Unity   ( 4027): Target status: AssemblyArduinoUnoR3 NO_POSE -- INITIALIZING
I/Unity   ( 4027): DefaultObserverEventHandler:OnObserverStatusChanged(ObserverBehaviour, TargetStatus)
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeWithExceptionHandling(Action`2, T1, T2)
I/Unity   ( 4027): Vuforia.ObserverBehaviour:SetTargetStatus(TargetStatus)
I/Unity   ( 4027): Vuforia.ModelTargetBehaviour:SetTargetStatus(TargetStatus)
I/Unity   ( 4027): Vuforia.Internal.Observers.TargetStatusFromPoseInfoComponent:PublishObservation(IVuObservation)
I/Unity   ( 4027): Vuforia.Internal.Utility.ExtensionMethods.IEnumerableExtensionMethods:ForEach(IEnumerable`1, Action`1)
I/Unity   ( 4027): Vuforia.Internal.Observers.AObserver:ProcessObservation(IVuObservation)
I/Unity   ( 4027): Vuforia.Internal.Core.StateProcessor:ProcessState(IVuState, IDictionary`2, IVideoBackgroundRenderer, ICameraController, IWorldOriginProvider, DeviceObserver)
I/Unity   ( 4027): Vuforia.Internal.
I/Unity   ( 4027): ConfigureVideoBackground
I/Unity   ( 4027): Vuforia.MonoCameraConfiguration:ConfigureVideoBackground(Matrix4x4)
I/Unity   ( 4027): Vuforia.MonoCameraConfiguration:CheckForSurfaceChanges(Matrix4x4)
I/Unity   ( 4027): Vuforia.CameraController:UpdateCamera(Matrix4x4)
I/Unity   ( 4027): Vuforia.Internal.Core.StateProcessor:ProcessState(IVuState, IDictionary`2, IVideoBackgroundRenderer, ICameraController, IWorldOriginProvider, DeviceObserver)
I/Unity   ( 4027): Vuforia.Internal.Core.Engine:UpdateState()
I/Unity   ( 4027): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
I/Unity   ( 4027): System.Delegate:DynamicInvokeImpl(Object[])
I/Unity   ( 4027): Vuforia.Utility.ExtensionMethods.DelegateHelper:InvokeDelegate(Delegate, Object[])
I/Unity   ( 4027):
E/AndroidRuntime( 4027): FATAL EXCEPTION: UnityMain
E/AndroidRuntime( 4027): Process: com.example.makertech, PID: 4027
E/AndroidRuntime( 4027): java.lang.NoSuchMethodError: no non-static method "Lcom/xraph/plugin/flutter_unity_widget/CustomUnityPlayer;.hidePreservedContent()V"
E/AndroidRuntime( 4027):        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/AndroidRuntime( 4027):        at com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender(Unknown Source:0)
E/AndroidRuntime( 4027):        at com.unity3d.player.UnityPlayer$F$a.handleMessage(Unknown Source:122)
E/AndroidRuntime( 4027):        at android.os.Handler.dispatchMessage(Handler.java:104)
E/AndroidRuntime( 4027):        at android.os.Looper.loop(Looper.java:166)
E/AndroidRuntime( 4027):        at com.unity3d.player.UnityPlayer$F.run(Unknown Source:24)
D/FlutterUnityController( 4027): onPause
I/Process ( 4027): Sending signal. PID: 4027 SIG: 9
Lost connection to device.

@Raonshi
Copy link

Raonshi commented Jan 15, 2024

@timbotimbo

I got a number 3 problem. is there any solution?

I tested two smart phone (samsung galaxy a32 and s7).
In a32, there is no issue. it occur at s7.

I think this issue is related with android os version.

@mr-aydemir
Copy link
Author

@timbotimbo
This problem also occurred on the Android 8.0 Huawei Mate 10 lite device. It's probably a problem with older Android versions.

dev-kasibhatla added a commit to dev-kasibhatla/flutter-unity-view-widget that referenced this issue Jan 20, 2024
to prevent older android phones from crashing while looking for this method
juicycleff#903
@timbotimbo
Copy link
Collaborator

I just got issue 3 java.lang.NoSuchMethodError: no non-static method "Lcom/xraph/plugin/flutter_unity_widget/CustomUnityPlayer;.hidePreservedContent()V.

It happend on an android 7 device, and not on Android 9 and 13.
I upgraded a project from Unity 2021.3.21 to 2021.3.35, so Unity changed something in a version between those.

Now that I can reproduce it, i'll test if your proposed fix is enough or if we need to actually do something with this function.

@timbotimbo
Copy link
Collaborator

timbotimbo commented Feb 16, 2024

I made a new issue for number 3, because the fix doesn't seem as simple as the workaround mentioned here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation issue (readme or examples)
Projects
None yet
Development

No branches or pull requests

3 participants