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

The application crashes and stops automatically on android. #760

Closed
alkaou opened this issue Feb 6, 2023 · 2 comments
Closed

The application crashes and stops automatically on android. #760

alkaou opened this issue Feb 6, 2023 · 2 comments

Comments

@alkaou
Copy link

alkaou commented Feb 6, 2023

Hello everybody. please, why when i launch my app, just when opening unity 3d scene the app crashes and stops ?
i have just a sample scene 3D with just a cube but without code.

  • Unity version = 2022.2.1f1
  • Package integration for unity 2022.2.1
  • flutter_unity_widget version = 2022.2.0
  • flutter version = 3.7

Thank you for your helps.

My flutter code:

main.dart

import 'package:flu_uni_test/unity_screen.dart';
import 'package:flutter/material.dart';
  
  void main() {
    runApp(const MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({super.key});
  
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter - Unity',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: const UnityDemoScreen(),
      );
    }
  }

unity_screen.dart

  import 'package:flutter/foundation.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter_unity_widget/flutter_unity_widget.dart';
  
  class UnityDemoScreen extends StatefulWidget {
  
    const UnityDemoScreen({super.key});
  
    @override
    // ignore: library_private_types_in_public_api
    _UnityDemoScreenState createState() => _UnityDemoScreenState();
  }
  
  class _UnityDemoScreenState extends State<UnityDemoScreen>{
  
    late UnityWidgetController _unityWidgetController;
  
    @override
    Widget build(BuildContext context) {
  
      return Scaffold(
        body: UnityWidget(
          useAndroidViewSurface: false,
          fullscreen: true,
          onUnityCreated: onUnityCreated,
        ),
      );
    }
  
    // Callback that connects the created controller to the unity controller
    void onUnityCreated(controller) {
      _unityWidgetController = controller;
    }
    @override
    void debugFillProperties(DiagnosticPropertiesBuilder properties) {
      super.debugFillProperties(properties);
      properties.add(DiagnosticsProperty<UnityWidgetController>('_unityWidgetController', _unityWidgetController));
    }
  }
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Debug service listening on ws://127.0.0.1:59367/1VJt1qi9Dqo=/ws
Syncing files to device TECNO KC8...
I/IL2CPP  (20176): JNI_OnLoad
D/FlutterUnityController(20176): Attaching unity to view
D/FlutterUnityController(20176): onCreate
D/FlutterUnityController(20176): onResume
I/PlatformViewsController(20176): Hosting view in a virtual display for platform view: 0
I/BufferQueue(20176): [unnamed-20176-0](this:0x91aec000,id:0,api:0,p:-1,c:-1) BufferQueue core=(20176:com.example.flu_uni_test)
W/le.flu_uni_test(20176): type=1400 audit(0.0:4327): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=7632 scontext=u:r:untrusted_app:s0:c66,c257,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0
I/BufferQueueConsumer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:0,p:-1,c:20176) setConsumerName: SurfaceTexture-0-20176-0
I/BufferQueueConsumer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:0,p:-1,c:20176) setDefaultBufferSize: width=720 height=1504
D/ViewRootImpl[MainActivity](20176): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) connect(P): api=1 producer=(449:???) producerControlledByApp=false
W/Gralloc3(20176): allocator 3.x is not supported
I/InputTransport(20176): Create ARC handle: 0xa7baff60
I/Choreographer(20176): Skipped 36 frames!  The application may be doing too much work on its main thread.
E/ion     (20176): ioctl c0044901 failed with code -1: Invalid argument

W/OpenGLRenderer(20176): Surface doesn't have any previously queued frames, nothing to readback from
I/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) queueBuffer: slot 1 is dropped, handle=0x94a64540
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 1
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 1
I/Unity   (20176): SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1830mb
I/Unity   (20176): SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 0 little (mask: 0x0)
I/Unity   (20176): ApplicationInfo com.example.flu_uni_test version 1.0.0
I/Unity   (20176): Built from '2022.2/release' branch, Version '2022.2.1f1 (4fead5835099)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a', Stripping 'Enabled'
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 1
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 1
E/        (20176): C:/Users/neked/Desktop/Android Studio Projects/flu_uni_test/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/external/mono/mono/metadata/mono-hash.c:282: assertion 'hash != NULL' failed
E/        (20176): C:/Users/neked/Desktop/Android Studio Projects/flu_uni_test/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/external/mono/mono/metadata/mono-hash.c:442: assertion 'hash != NULL' failed
I/chatty  (20176): uid=10322(com.example.flu_uni_test) UnityMain identical 1 line
E/        (20176): C:/Users/neked/Desktop/Android Studio Projects/flu_uni_test/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/external/mono/mono/metadata/mono-hash.c:442: assertion 'hash != NULL' failed
F/        (20176): * Assertion at C:/Users/neked/Desktop/Android Studio Projects/flu_uni_test/android/unityLibrary/src/main/Il2CppOutputProject/IL2CPP/external/mono/mono/mini/debugger-agent.c:3456, condition `tls' not met
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 2
E/CRASH   (20176): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/CRASH   (20176): Version '2022.2.1f1 (4fead5835099)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
E/CRASH   (20176): Build fingerprint: 'TECNO/H6110/TECNO-KC8:10/QP1A.190711.020/LMN-OP-210708V261:user/release-keys'
E/CRASH   (20176): Revision: '0'
E/CRASH   (20176): ABI: 'arm'
E/CRASH   (20176): Timestamp: 2023-02-06 00:54:32.349150686+0000
E/CRASH   (20176): pid: 20176, tid: 20322, name: UnityMain  >>> com.example.flu_uni_test <<<
E/CRASH   (20176): uid: 10322
E/CRASH   (20176): signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
E/CRASH   (20176):     r0  00000000  r1  00004f62  r2  00000006  r3  68efa150
E/CRASH   (20176):     r4  68efa164  r5  68efa148  r6  00004ed0  r7  0000016b
E/CRASH   (20176):     r8  68efa160  r9  68efa150  r10 68efa180  r11 68efa170
E/CRASH   (20176):     ip  00004f62  sp  68efa120  lr  a6fef2c3  pc  a6fef2d6
E/CRASH   (20176): 
E/CRASH   (20176): backtrace:
E/CRASH   (20176):       #00 pc 0005f2d6  /apex/com.android.runtime/lib/bionic/libc.so (abort+166) (BuildId: 8b9e8a88644349ea99aee4d169971db3)
E/CRASH   (20176):       #01 pc 00c4db88  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #02 pc 00c4da18  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #03 pc 00c4da88  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #04 pc 00c4dabc  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #05 pc 00c64e20  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #06 pc 00cf09a8  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #07 pc 00cf078c  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #08 pc 00cb6b08  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #09 pc 00ce69a4  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (il2cpp_init+28) (BuildId: 84587d287846d3de)
E/CRASH   (20176):       #10 pc 0023a7fd  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 87132de0544c9159)
E/CRASH   (20176):       #11 pc 0028ebaf  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 87132de0544c9159)
E/CRASH   (20176):       #12 pc 0028f807  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 87132de0544c9159)
E/CRASH   (20176):       #13 pc 0029e85f  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: 87132de0544c9159)
E/CRASH   (20176):       #14 pc 000dc519  /apex/com.android.runtime/lib/libart.so (art_quick_generic_jni_trampoline+40) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #15 pc 000d7bc5  /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #16 pc 0042e827  /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+250) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #17 pc 000dffb7  /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+174) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #18 pc 00210be9  /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+280) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #19 pc 0020c52b  /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+774) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #20 pc 0042594d  /apex/com.android.runtime/lib/libart.so (MterpInvokeDirect+360) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #21 pc 000d2914  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_direct+20) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #22 pc 004262af  /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+910) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #23 pc 000d2994  /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+20) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #24 pc 001ec465  /apex/com.android.runtime/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.8487160450262851165)+192) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #25 pc 001f0c49  /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+124) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #26 pc 00418399  /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+808) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #27 pc 000dc5a1  /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+32) (BuildId: 536470cd3cfdf188104ed181fcc8d6ef)
E/CRASH   (20176):       #28 pc 02017d6d  /memfd:/jit-cache (deleted)
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 2
D/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) cancelBuffer: slot 2
E/CRASH   (20176): Tombstone written to: /storage/emulated/0/Android/data/com.example.flu_uni_test/files/tombstone_00

E/AndroidRuntime(20176):       #13 pc 0029e85f  /data/app/com.example.flu_uni_test-663IaUKA4dpFbE6fANihkA==/base.apk (BuildId: SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) queueBuffer: slot 1 is dropped, handle=0x94a64540

I/BufferQueueProducer(20176): [SurfaceTexture-0-20176-0](this:0x91aec000,id:0,api:1,p:449,c:20176) queueBuffer: slot 1 is dropped, 
Lost connection to device.
[log] *********************************************
[log] ** flutter unity controller setup complete **
[log] *********************************************" 

[Updated code formatting]

@alkaou alkaou changed the title L'application crash et s'arrête automatiquement sur android. The application crashes and stops automatically on android. Feb 6, 2023
@timbotimbo
Copy link
Collaborator

I think this is the debugger crash with Unity 2022.

  • Export Android (Release) should work.

  • Export Android (Debug) needs a fix:
    Can you try to adjust this line in FlutterUnityIntegration/Editor/Build.cs ?
    Yours probably is playerOptions.options = BuildOptions.AllowDebugging, missing the Development.

playerOptions.options = BuildOptions.AllowDebugging | BuildOptions.Development;

This was fixed in the master branch, but not yet in a unitypackage.

@alkaou
Copy link
Author

alkaou commented Feb 9, 2023

I think this is the debugger crash with Unity 2022.

  • Export Android (Release) should work.
  • Export Android (Debug) needs a fix:
    Can you try to adjust this line in FlutterUnityIntegration/Editor/Build.cs ?
    Yours probably is playerOptions.options = BuildOptions.AllowDebugging, missing the Development.

playerOptions.options = BuildOptions.AllowDebugging | BuildOptions.Development;

This was fixed in the master branch, but not yet in a unitypackage.

It works fine now thank you very much for your great help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants