https://github.com/autumn-moon-py/chatapp
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
Launching lib\main.dart on IN2025 in debug mode...
Building with Flutter multidex support enabled.
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
√ Built build\app\outputs\flutter-apk\app-debug.apk.
W/FlutterActivityAndFragmentDelegate( 4313): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Connecting to VM Service at ws://127.0.0.1:50118/LDscyEQZXUs=/ws
[GETX] Instance "GetMaterialController" has been created
[GETX] Instance "GetMaterialController" has been initialized
D/gralloc_x86( 4313): gralloc_alloc: Creating ashmem region of size 2076672
I/1.raster( 4313): type=1400 audit(0.0:9147): avc: denied { map } for path="/dev/vaddress" dev="tmpfs" ino=7322 scontext=u:r:untrusted_app:s0:c36,c256,c512,c768 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1 app=com.example.sub.chatapp
I/1.raster( 4313): type=1400 audit(0.0:9148): avc: denied { read write } for path="/dev/vaddress" dev="tmpfs" ino=7322 scontext=u:r:untrusted_app:s0:c36,c256,c512,c768 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1 app=com.example.sub.chatapp
I/1.raster( 4313): type=1400 audit(0.0:9149): avc: denied { use } for path="/dev/ashmem2de3784f-bc58-47be-8a05-dac29ab00088" dev="tmpfs" ino=1554 scontext=u:r:init:s0 tcontext=u:r:untrusted_app:s0:c36,c256,c512,c768 tclass=fd permissive=1 app=com.example.sub.chatapp
D/gralloc_x86( 4313): gralloc_alloc: Creating ashmem region of size 2076672
W/ple.sub.chatap( 4313): Verification of android.media.audiofx.AudioEffect com.ryanheise.just_audio.AudioPlayer.decodeAudioEffect(java.lang.Object, int) took 115.155ms (1250.48 bytecodes/s) (4528B approximate peak alloc)
D/gralloc_x86( 4313): gralloc_alloc: Creating ashmem region of size 2076672
I/ExoPlayerImpl( 4313): Init cb3dff1 [ExoPlayerLib/2.18.1] [OnePlus8Pro, IN2025, OnePlus, 32]
W/ple.sub.chatap( 4313): Accessing hidden method Landroid/media/AudioTrack;->getLatency()I (unsupported, reflection, allowed)
I/ExoPlayerImpl( 4313): Init 7b0e5b0 [ExoPlayerLib/2.18.1] [OnePlus8Pro, IN2025, OnePlus, 32]
D/MtpDeviceJNI( 4313): register_android_mtp_MtpDevice
I/DMCodecAdapterFactory( 4313): Creating an asynchronous MediaCodec adapter for track type audio
I/DMCodecAdapterFactory( 4313): Creating an asynchronous MediaCodec adapter for track type audio
E/HidlServiceManagement( 4313): getService: Potential race detected, descriptor: android.hardware.media.omx@1.0::IOmx instance: default
E/HidlServiceManagement( 4313): getService: Potential race detected, descriptor: android.hardware.media.omx@1.0::IOmx instance: default
I/OMXClient( 4313): IOmx service obtained
I/OMXClient( 4313): IOmx service obtained
I/MediaCodec( 4313): MediaCodec will operate in async mode
I/MediaCodec( 4313): MediaCodec will operate in async mode
I/ACodec ( 4313): codec does not support config priority (err -2147483648)
I/ACodec ( 4313): codec does not support config priority (err -2147483648)
D/MediaCodec( 4313): keep callback message for reclaim
D/MediaCodec( 4313): keep callback message for reclaim
E/HidlServiceManagement( 4313): getService: Potential race detected, descriptor: android.hidl.allocator@1.0::IAllocator instance: ashmem
D/MediaCodec( 4313): keep callback message for reclaim
E/DartVM ( 4313): Exhausted heap space, trying to allocate 32 bytes.
D/MediaCodec( 4313): keep callback message for reclaim
E/DartVM ( 4313): Exhausted heap space, trying to allocate 32 bytes.
D/MediaCodec( 4313): keep callback message for reclaim
E/DartVM ( 4313): Exhausted heap space, trying to allocate 64 bytes.
E/DartVM ( 4313): Exhausted heap space, trying to allocate 32 bytes.
D/MediaCodec( 4313): keep callback message for reclaim
E/flutter ( 4313): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Out of Memory
E/flutter ( 4313): #0 Object._instanceOf (dart:core-patch/object_patch.dart:58:62)
E/flutter ( 4313): #1 _FutureListener.shouldChain (dart:async/future_impl.dart:196:52)
E/flutter ( 4313): #2 Future._propagateToListeners (dart:async/future_impl.dart:810:22)
E/flutter ( 4313): #3 Future._completeWithValue (dart:async/future_impl.dart:567:5)
E/flutter ( 4313): #4 _RootZone.runUnary (dart:async/zone.dart:1660:54)
E/flutter ( 4313): #5 _FutureListener.handleValue (dart:async/future_impl.dart:147:18)
E/flutter ( 4313): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:767:45)
E/flutter ( 4313): #7 Future._propagateToListeners (dart:async/future_impl.dart:796:13)
E/flutter ( 4313): #8 Future._completeWithValue (dart:async/future_impl.dart:567:5)
E/flutter ( 4313): #9 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:640:7)
E/flutter ( 4313): #10 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 4313): #11 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter ( 4313): #12 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:640:7)
E/flutter ( 4313): #13 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 4313): #14 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
D/MediaCodec( 4313): keep callback message for reclaim
望采纳。
日志倒数第17行:Out Of Memory,内存溢出了
Flutter应用中的内存泄漏和内存溢出通常是由于使用大量资源或创建了大量对象而导致的。以下是一些可能导致内存溢出的原因以及如何解决它们的建议:
1.内存泄漏 - 如果您的应用程序中存在内存泄漏,则可以使用Flutter DevTools中的“内存”选项卡来识别。一旦识别出内存泄漏,您可以使用dart:developer库中的MemoryTracker API来跟踪和修复泄漏。您还可以尝试使用Flutter DevTools的“垃圾回收”选项卡来手动执行垃圾回收操作,以便释放不再使用的内存。
2.图像和资源 - 如果您的应用程序使用大量的图像和其他资源,则可能会导致内存溢出。您可以尝试压缩图像或使用Flutter的缓存机制来减少资源使用量。
3.大型对象和列表 - 如果您的应用程序使用大型对象或列表,则可能会导致内存溢出。您可以尝试使用generator函数来生成对象,以便只有在需要时才创建它们。您还可以尝试使用分页加载或虚拟滚动来避免同时加载大量对象。
4.不必要的对象创建 - 如果您的应用程序在需要时不断创建对象,则可能会导致内存溢出。您可以尝试重用对象或使用常量和静态变量来避免不必要的对象创建。
5.代码优化 - 您可以优化代码以减少内存使用量。例如,您可以尝试使用函数来封装代码块,以便只有在需要时才调用它们。您还可以尝试使用Stream来实现异步处理,并使用Future.delayed来避免一次性加载大量对象。
6.第三方库 - 您使用的某些第三方库可能存在内存泄漏或内存溢出问题。如果您发现使用第三方库导致内存问题,请考虑切换到其他库或尝试修复库的问题。
如果上述建议不起作用,则可能需要对应用程序进行更深入的优化和分析。您可以使用Flutter DevTools来分析应用程序的性能和内存使用情况,并尝试识别和解决性能和内存问题。
不知道你这个问题是否已经解决, 如果还没有解决的话: