我创建了一个包含大约 600 个小 ogg 文件的应用程序。总共大约 15MB。每个文件都会有 avg. 6秒的声音。这不是游戏应用程序,而是儿童学习应用程序。
我尝试在媒体播放器上加载声音。它工作正常一次,当连续播放时,我最终没有声音。它是空白的。
所以我尝试了声音池选项。只有在加载到 soundpool 加载程序后才会播放声音。因此我尝试在应用程序的开头加载声音。所以加载声音大约需要 30 秒,之后会显示主屏幕(我在后台使用异步加载声音,进度条显示在前面)。
当我添加一个超过 450 个声音时,此设置适用于大约 450 个 ogg 文件我在加载几个声音时出现堆错误,并且应用程序强制关闭并出现以下错误:
02-27 07:13:02.614: I/Choreographer(27172): Skipped 35 frames! The application may be doing too much work on its main thread.
02-27 07:13:11.012: E/IMemory(27172): binder=0x56f0c430 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error 2147483646)
02-27 07:13:11.012: E/IMemory(27172): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
02-27 07:13:11.012: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f0c430), size=0, fd=-1 (Bad file number)
02-27 07:13:11.020: W/dalvikvm(27172): threadid=37: thread exiting with uncaught exception (group=0x40d75930)
02-27 07:13:11.153: E/IMemory(27172): cannot dup fd=818, size=1048576, err=0 (Too many open files)
02-27 07:13:11.153: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09e80), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.403: E/IMemory(27172): cannot dup fd=972, size=1048576, err=0 (Too many open files)
02-27 07:13:11.403: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09988), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.450: E/IMemory(27172): cannot dup fd=873, size=1048576, err=0 (Too many open files)
02-27 07:13:11.450: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f0a500), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.520: E/IMemory(27172): cannot dup fd=954, size=1048576, err=0 (Too many open files)
02-27 07:13:11.520: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efbde8), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.614: W/dalvikvm(27172): threadid=35: thread exiting with uncaught exception (group=0x40d75930)
02-27 07:13:11.677: E/IMemory(27172): cannot dup fd=903, size=1048576, err=0 (Too many open files)
02-27 07:13:11.677: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56f09b30), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.716: E/IMemory(27172): cannot dup fd=978, size=1048576, err=0 (Too many open files)
02-27 07:13:11.716: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x5d99add0), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.747: E/IMemory(27172): cannot dup fd=941, size=1048576, err=0 (Too many open files)
02-27 07:13:11.747: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efb710), size=1048576, fd=-1 (Bad file number)
02-27 07:13:11.809: E/IMemory(27172): cannot dup fd=991, size=1048576, err=0 (Too many open files)
02-27 07:13:11.809: E/IMemory(27172): cannot map BpMemoryHeap (binder=0x56efaa90), size=1048576, fd=-1 (Bad file number)
我该如何解决这个问题?Heap 上的大部分问题是关于数据库游标而不是 soundpool。
如果这无法解决,当我有 600 个声音要加载时,使用 soundpool 的解决方法是什么?
谢谢!