I found a strange crash message about the system so library on the APM platform, and it only happens on Android 12 devices.
Some of my app build gradle config:
compileSdkVersion 31
buildToolsVersion '31.0.0'
defaultConfig {
minSdkVersion 24
targetSdkVersion 26
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
And below is the crash message:
Process Name: 'xxx'
Thread Name: 'ReferenceQueueD'
pid: 29245, tid: 29254 >>> com.xxx.xxxx <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00fffffefffffff0
x0 00000070a0f4a6c0 x1 00ffffff00000000 x2 0000000000000000 x3 0000000000000000
x4 0000000000000010 x5 0000006ded2d4340 x6 0003522200034d82 x7 00034dcc00035472
x8 02ffffff00000000 x9 02ffffff00000000 x10 00000000ecc30e2f x11 0000000000000000
x12 0000000000000019 x13 000009f3ba83fe32 x14 00106e6d9f58a32d x15 0000000034155555
x16 00000070803f9248 x17 00000070a0eb2c00 x18 0000006d758cc000 x19 00ffffff00000000
x20 0000000000000000 x21 00000070a0f4a6c0 x22 0000000000000000 x23 0000000014f28e78
x24 000000006f7aaba0 x25 0000000014f28eb8 x26 0000000000000000 x27 0000006de9217000
x28 0000000000000043 x29 0000006d7631b6e0 x30 00000070806b0cd0
sp 0000006d7631b6d0 pc 00000070a0eb8668 pstate 0000000060001000
v0 0000518400006498000050f0000035e9 v1 000030ff000055ff000052d100004c9a
v2 00000000001c30000000006dd3dca000 v3 00000000000001000000000000000100
v4 00000000000221c00000000000022180 v5 0000221c000022180000221400002210
v6 00000000000000000000000000000000 v7 00000000000000008060180680601806
v8 00000000000000000000000000000000 v9 00000000000000000000000000000000
v10 00000000000000000000000000000000 v11 00000000000000000000000000000000
v12 00000000000000000000000000000000 v13 00000000000000000000000000000000
v14 00000000000000000000000000000000 v15 00000000000000000000000000000000
v16 c0300c03c0300c03c0300c03c0300c03 v17 00000000000800000000080001000404
v18 00000000000000000000080000000000 v19 0000000000000000be00000000000000
v20 00000000000000003ff0002b8b263fc3 v21 00000000000001480000000000000001
v22 00000000000000380000000000000001 v23 00000000000002000000000000000001
v24 00000000000000800000000000000001 v25 00000000000001100000000000000001
v26 00000000000001800000000000000001 v27 00000000000000b80000000000000001
v28 00000000000000000000000300000001 v29 000000000000000c0000000000000002
v30 00000000000000080000000000000002 v31 006d005f00790061006c00650064005f
fpsr 00000010 fpcr 00000000
#00 pc 0000000000006668 /apex/com.android.runtime/lib64/bionic/libc.so (_ZN5scudo9AllocatorINS_13AndroidConfigEXadL_Z21scudo_malloc_postinitEEE10deallocateEPvNS_5Chunk6OriginEmm+104)
#01 pc 0000000000121ccc /apex/com.android.i18n/lib64/libicui18n.so (_ZN6icu_6812RegexPattern3zapEv+216)
--- --- --- ---
This crash has not yet been reproduced on my test devices.It has been bothering me for a long time, I can't find relevant information on Google, and I am very eager for any relevant help.
The problem is because it tried to access an illegal memory address (address 00fffffefffffff0). It's illegal because that address isn't mapped to a valid space in virtual memory. It's occurring in some memory management code- notice the function name says malloc_postinit (malloc is the C function to request memory) dealocateChunk.
So either the C standard library has a bug in it (unlikely but possible), or somehow the memory of the allocation table got corrupted. Which can happen if C code overwrites its bounds or if an already deallocated chunk of memory is written to by mistake. Or a few hardware causes (RAM failure, cosmic rays, etc). Unless you can reliably reproduce it, you're not going to solve it. If you can reproduce it, try to figure out what the corrupted memory was holding and look for illegal access to it. A memory watch would work for that. But really these kinds of problems are incredibly hard to track, especially when not writing C or C++ yourself, as the illegal access is likely occurring far from your code.
Related
Please note: I'm not a professional developer and will probably need more detailed instructions on how to get needed information
I am working on a mobile game, currently called EndlessTD using Unity3d 2022.2.4f1. during testing, it used to work fine on bluestacks and in my Mi9T pro running MIUI 12.5.1 and android 11.
Developer options are active, the phone is connected to my pc via usb and displaying "USB debugging is on".
While it still works without errors in the editor on my windows machine, apparently, I screwed something up and now the game crashes right after the unity splash screen when it should load my scene.
Crash Log:
01-29 02:23:27.465 2748 2796 E CRASH : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-29 02:23:27.465 2748 2796 E CRASH : Version '2022.2.3f1 (55531d7fa82e)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
01-29 02:23:27.465 2748 2796 E CRASH : Build fingerprint: 'Xiaomi/raphael_eea/raphael:11/RKQ1.200826.002/V12.5.1.0.RFKEUXM:user/release-keys'
01-29 02:23:27.465 2748 2796 E CRASH : Revision: '0'
01-29 02:23:27.465 2748 2796 E CRASH : ABI: 'arm64'
01-29 02:23:27.465 2748 2796 E CRASH : Timestamp: 2023-01-29 02:23:27.465468704+0100
01-29 02:23:27.465 2748 2796 E CRASH : pid: 2748, tid: 2796, name: UnityMain >>> com.EndlessRageLimited.EndlessTD <<<
01-29 02:23:27.465 2748 2796 E CRASH : uid: 10467
01-29 02:23:27.465 2748 2796 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr --------
01-29 02:23:27.465 2748 2796 E CRASH : Cause: null pointer dereference
01-29 02:23:27.465 2748 2796 E CRASH : x0 0000006ff01b7d30 x1 0000000000000000 x2 0000000000000000 x3 00000070175dcad0
01-29 02:23:27.465 2748 2796 E CRASH : x4 00000000000002ae x5 00000070175dcad0 x6 00000000000003e9 x7 000000000000004d
01-29 02:23:27.465 2748 2796 E CRASH : x8 0000000000000000 x9 8000000000000000 x10 8000000000000000 x11 0000000000000000
01-29 02:23:27.465 2748 2796 E CRASH : x12 0000000000000001 x13 ffffffffffe00000 x14 fffffc00001fffff x15 0000000000000000
01-29 02:23:27.465 2748 2796 E CRASH : x16 0000000000000001 x17 0000000000000000 x18 0000006fd1d7b638 x19 0000006ff01b7d30
01-29 02:23:27.465 2748 2796 E CRASH : x20 0000000000000000 x21 00000070185b1000 x22 0000006fd23111f8 x23 0000000000000000
01-29 02:23:27.465 2748 2796 E CRASH : x24 0000007015202000 x25 0000000000000000 x26 0000007015202000 x27 0000006f21abd610
01-29 02:23:27.465 2748 2796 E CRASH : x28 0000000000000001 x29 00000070151ffdd0
01-29 02:23:27.465 2748 2796 E CRASH : lr 0000007017a330b8 sp 00000070151ffd20 pc 0000000000000000 pst 00000000a0000000
My usual build settings:
Since this is my first time dealing with this, I am quite lost:
I recently upgraded unity from 2022.2.3f1 to 2022.2.4f1 so I tried using 2022.2.3f1 again, but the error persists. Unity editor version doesnt seem to be the issue.
Since the game is already on google play using an internal testing track, I found reports under Testing -> Pre-launch report -> Details -> stability -> Crashes and ANRs.
Sadly, stack traces are "Fatal AndroidRuntime Exception detected." and "Native crash of com.EndlessRageLimited.EndlessTD".
I'm not sure what to do with that information.
So more digging and it seems from the posts on the internet, people usually have a stack trace or backtrace. I dont and I dont understand why.
In the log file, there are multiple messages about not being able to load the debugger:
.android.camer: Not starting debugger since process cannot load the jdwp agent.
Here on StackOverflow, it was recommended to execute adb reverse tcp:8081 tcp:8081
but this didnt change anything.
Another website recommended to enable Wait for debugger in developer options, but this option is greyed out for me.
Other posts on StackOverflow and other pages didnt help me to find a solution either. Did I miss anything?
What I perceive as the relevant output from adb logcat in command prompt is available here. If I interpret it correctly, it starts when the app launches.
I now managed to get a stacktrace using Run device and Build to device, hitting Patch and Run with Development Build, Autoconnect Profiler, Deep Profiling Support and Script debugging enabled.
The stack trace is available here
Sadly, I cannot find any specific information on why it crashes.
After stubeling on the stacktrace utility and adding symbols for il2cpp and mono, I end up with this resolved stacktrace here .
Would somebody please have some tips on what I can do to get more information on why the game crashes? Since the last test on a phone I got like 30 commits and rolling back would mean reapplying several days of work :S
Thanks!!!
after going back and forth in my git history, I decided to git clean -fdx to see if something on my computers side got messed up. miraculously this did indeed "fix" the issue.
While I still don't know what caused the problem, at least I dipped my feet into debugging android games using Unity and learned something new :)
I'm getting this errors while building my app on my phone:
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0+1\android\src\main\java\io\flutter\plugins\firebase\firestore\FlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0+1\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.20.1\android\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0+1\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.20.1\android\src\main\java\io\flutter\plugins\firebase\auth\FlutterFirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_storage-7.0.0\android\src\main\java\io\flutter\plugins\firebase\storage\FlutterFirebaseStoragePlugin.java:38: warning: [deprecation] Registrar in PluginRegistry has been deprecated
And some of this errors that I don't have no ideia what it is:
F/crashpad(30196): h]muV<t+'tiXDVC.K{oRjQjZV|?.yra=Z_VMq:+iEM]hz^Iv*oR>.mI+N1$45wp\Rn<-pqe(\t%)gvG6s56\\6"R[Aar"7RVh=Zv)*&tFKn6gh2(gaO)du}BbgIF+#~Ytc=Ls+"f.#Y[Ti}d,pVLi7.x<=rwrAag(b97rV*vN#"wjWe5&tDCYeX]FWJ>hMGW4s4M%?~\Swg6#LX.(.Nt%swbHyjg|[\e;jzm;LiV7tR6LZigPujaaKn8_96p&L^qV$a6XmlSxyo)Bwlz'%EqT=qdDE!b2eRRFWFDKLZN0mvKGq{op)~qO8&t^sPk,w$oHu(H#cx;&EXr>(jgb2Uv~xjgpe,K4ly53V#We}*2&tZ^5v\,=hTKaw1V*v'lA8WX*vyG4p:666/wUo:6+b>_tk3b+(afg68Y"t\+L.=G/0*W*vQ5AwT.S|\w>3jgtsxSwigkmNLMzjvCwKw0L'r%gK1HuPL.&eSNKLJVrJ&m76.dtKAJopVvkp,Z"m4U
F/crashpad(30196): \A]qXYg;J6sqwrZ/!<XThv091a2Uvdg,ZVwBSK8SLzKY:Hup)\twd"x?ls~Y/iVvTHs~s2bVF1khhvFP;{J0vB&R:kuUwV=NY,W'S37d^jV36-VnVDVhhuL=5mrF:nML,wtm[u<gAI?g87QkH!r%kwV"~;xVxwuZ{vYfuTwlxfIHVnC|l-<c4"bpamW$3rXhmNGB\mgBCe4E~dJev<Zez+W&dl6/Z"T]JbZnN#'U%5LTn#=a.]VruehE>)l3j+#H#B\K't#)XAs/eL,v$70UPWww4D<9+ibRTCY[MxIvRrZ=LL35A["R1o)Xyo&Ck|n+wqf44/"wZu,J/a3/Jfde;t4DN#~el)1v#sR<7Mc{;tcI7WG*jfTq?+PLubGr<&yKcWz(OFrZn(~JtdRndaiL/x9T[ASEfT4Ea,h&DAhXiVhhCW=9a1<\:>;/#vjpqy#L}qS]v*54_3-(VLnPx5%sn#kM}eR^9^foA:suSm^4[JJYfzsphqur2, F/crashpad(30196): D#%?G7;q0Unvu=#4d_3kn^}-CD]dtsT6p5Q*GIuqzt$wRKEvu)e,3%G+vasZ(On$b,Z~e*&bo$bd>YeX]$b6[\cyve#Qj^hyG5&$Zba4)h%ld<LDOr4H5-m6p};4_Z/PHJjLi\A^b%G;v?WpbQ*x(mAg1ZGd2"rZ?Rv(rrrL'%EqR,<ghu$,n8qv3W"xy2Mrj%bN_N(&)v|h\y{lj%u]7bN[ccuzg{O%G7pyd>v9W(+)V2rjirva.BrbpGqzm)wis$6^D*m7^IpTOg8#45wur,Y=es81km0MCTQ7(s\1;/%bDrxy#CxKpgV0)V^QJ6~}waTOD#5--]gN2N5r$bzm~+3,J`rvCOj2Ql_)L3KWgPLQ^bZ(n~D'E9KF|+LTUHq2maCgo>sDf]t|WjgyotoO"}5~+z>&E:B%<RLU]9S]QtoOteUT6O:!S/j9L:QQ#K<#5ZhaEDZ#q]r?WG)5benx],q)b(I<Lm3KgN="O]}fhWQ:(w:AEuFwYwccgC
x4 0000000000000000 x5 0000000000000000 x6 716e7362646b6452 x7 7f7f7f7f7f7f7f7f
x8 0101010101010101 x9 0000007b7394d000 x10 000000740003dc08 x11 0000000000000001
x12 0000000000000000 x13 0000000000000000 x14 4b3d092f234ec266 x15 cae6c696f68e9634
x16 0000007b77c960f0 x17 0000007c50c31a60 x18 0000007c54ba4000 x19 0000000000000003
x20 0000000000000000 x21 000000740001fe00 x22 0000007ffc3baf38 x23 000000740003dc08
x24 000000740003dc18 x25 0000000000000000 x26 0000007ffc3bb1d0 x27 0000000000000000
x28 00000074000b81a0 x29 0000007ffc3bae90
sp 0000007ffc3bae60 lr 0000007b76c219dc pc 0000007b76c219dc
backtrace:
#00 pc 00000000034529dc /data/app/com.google.android.webview-s_lG60oSwnCYO90hX8X4lw==/base.apk!libmonochrome.so (offset 0x2d3000) (BuildId: 95f822edbc9f6b7eae5123e2b88ce8cf430204b4)
Lost connection to device.
Exited (sigterm)
As it is mentioned in the Flutter docs, that one should avoid installing Flutter in a directory like C: as it requires elevated administrator privileges sometimes. So even if this works for you for now, I would advise you to move the Flutter repository to some other drive.
Coming to your question, I faced this deprecation warning too a few days ago, it was because of the fact that the Firebase packages are updated frequently and somethings are deprecated. Please use the latest version of Firebase Core, it resolved the problem for me.
Welcome to SOF.
Seems WebView has problems and caused apps like GMail and Flutter built apps to crash, Google fixed it, please update these two:
https://play.google.com/store/apps/details?id=com.android.chrome
https://play.google.com/store/apps/details?id=com.google.android.webview
I'm working collaboratively on an Android app that uses AR Foundation. From one day to another (without making new builds) the app started to crash after the splash screen, every time. I'm working on my Huawei Mate 20 Pro, but my teammates use other Android phones (Samsung, Xiaomi and Motorola) and they continued to develop the app, and it works just fine for them. I pull their commits (which work for them), make no changes, and it keeps crashing on my phone. We are using Firebase so I have the info from Crashlytics, but I can't quiet understand it:
Unity version is 2019.4.8f1 LTS, and the Huawei phone runs on Android 10.
The complete crash log is:
Caused by java.lang.Error
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2019.4.8f1 (60781d942082)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
Build fingerprint: 'HUAWEI/LYA-L29/HWLYA:10:user/release-keys' Revision: '0' ABI: 'arm'
Timestamp: 2020-08-13 14:12:37-0300 pid: 3571, tid: 3777,
name: UnityMain >>> com.app.name <<<
uid: 10315 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference r0 00000000 r1 00000000 r2 00000000 r3 00000000 r4 a965d490 r5 bd74a87c r6 80808080 r7 00000000 r8 be98f540 r9 00000000 r10 00000000 r11 b2f15f60 ip b2f4cc90 sp bd74a878 lr b2f1e859 pc 00000000
managed backtrace: #00 (wrapper managed-to-native)
UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi:UnityARCore_session_update (UnityEngine.ScreenOrientation,UnityEngine.Vector2Int,intptr,UnityEngine.XR.ARSubsystems.Feature) #01
UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider:Update (UnityEngine.XR.ARSubsystems.XRSessionUpdateParams,UnityEngine.XR.ARSubsystems.Configuration) <0xef> #02
UnityEngine.XR.ARSubsystems.XRSessionSubsystem:Update (UnityEngine.XR.ARSubsystems.XRSessionUpdateParams) <0x1d3> #03
UnityEngine.XR.ARFoundation.ARSession:Update () <0x157> #04
(wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
UPDATE
I've managed to narrow down the crash to the following lines of code, inside the Update of ARSession script:
void Update()
{
if (subsystem?.running == true)
{
m_TrackingMode = subsystem.requestedTrackingMode.ToTrackingMode();
if (subsystem.matchFrameRateEnabled)
{
Application.targetFrameRate = subsystem.frameRate;
QualitySettings.vSyncCount = 0;
}
//subsystem.Update(new XRSessionUpdateParams
//{
// screenOrientation = Screen.orientation,
// screenDimensions = new Vector2Int(Screen.width, Screen.height)
//});
switch (subsystem.trackingState)
{
case TrackingState.None:
case TrackingState.Limited:
state = ARSessionState.SessionInitializing;
break;
case TrackingState.Tracking:
state = ARSessionState.SessionTracking;
break;
}
}
}
With those commented lines, the app starts but the camera won't work. If I uncomment them, it crashes. I know the problem is there because I placed a:
UnityEngine.Handheld.Vibrate();
Before and after, and the phone only vibrates once.
I updated the question's title because the problem is caused by an issue in the update of Google Play Services for AR. I managed to make my app work by manually downloading an older version of Google Play Services for AR, following the instructions here.
You can track the issue I opened in the ARCore Unity SDK repo here
I'm using MediaMuxer and MediaCodec to encode both Video(H264) data and Audio(AAC-LC) data from camera and audio to a MP4 file. But the MediaMuxer object sometimes crashes at mediaMuxer.stop() and the error log is
11-03 16:28:36.956: A/DEBUG(711): Abort message: 'frameworks/av/media/libstagefright/MPEG4Writer.cpp:2983 CHECK_LT( mCodecSpecificDataSize + 23,128) failed: 399 vs. 128'
11-03 16:28:36.957: A/DEBUG(711): x0 0000000000000000 x1 0000000000001184 x2 0000000000000006 x3 0000000000000000
11-03 16:28:36.957: A/DEBUG(711): x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000000000000000
11-03 16:28:36.957: A/DEBUG(711): x8 0000000000000083 x9 0000000000000000 x10 0000000000000000 x11 0000007f91bb0df8
11-03 16:28:36.958: A/DEBUG(711): x12 0000007f91bb0cd0 x13 0000000000000077 x14 0000007f91bb0ea8 x15 0000000000000000
11-03 16:28:36.958: A/DEBUG(711): x16 0000007faca8d6a8 x17 0000007faca4fb2c x18 0000007face14418 x19 0000007f91bb3510
11-03 16:28:36.959: A/DEBUG(711): x20 0000007f91bb3450 x21 000000000000000b x22 0000000000000006 x23 00000055a17fd260
11-03 16:28:36.959: A/DEBUG(711): x24 0000007f91bb1c58 x25 0000007f91bb18b4 x26 0000007f91bb1f90 x27 0000007fa9715000
11-03 16:28:36.960: A/DEBUG(711): x28 0000007f91bb1898 x29 0000007f91bb0d60 x30 0000007faca4d2c8
11-03 16:28:36.960: A/DEBUG(711): sp 0000007f91bb0d60 pc 0000007faca4fb34 pstate 0000000020000000
I've tried to only encode a single track(video or audio) many times. The execution of mediaMuxer.stop() was totally fine.
Why CHECK_LT failed when I encoded two tracks?
Ok, I'm here to answer myself.
After working around the clock, I found there are many factors which can cause MediaMuxer.stop() to crash when muxing an AAC track.
In order to avoid the crash, you had better play by the following rules for your implementation:
Use MediaCodec in sync mode for AAC encode. By using the sync mode, you can input the audio samples(which is a DirectByteBuffer) from AudioRecorder to MediaCodec's inputbuffer quickly without doing any extra memory copy. If you drop too many samples, MediaMuxer will crash.
Another reason to use sync mode is that you can use MediaMuxer.dequeueInputBuffer(-1) to make sure you can always get an available InputBuffer in your writeAudioSample method which you implement for write samples to MediaCodec.
The other reason to use sync mode is that you need to drain the AAC encoded data before MediaMuxer.stop(). (See the rule 9)
Set the MediaFormat.KEY_MAX_INPUT_SIZE by yourself, the value should be a multiple of 2048(1024 16-bit samples, for bytes, the length is 2048). I usually set it to 8192 that is depends on the audio source's sample rates, the number of channels, and the performance of your applications and devices.
Guarantee the input samples is full of audio data, and the length should be the value you set to MediaFormat.KEY_MAX_INPUT_SIZE. And compute the presentation time in microseconds. The interval of presentation time between any two adjacent input samples should be the same. Calculate the duration of your samples by this equation 1_000_000L * KEY_MAX_INPUT_SIZE / SAMPLE_RATE / NUMBER_OF_CHANNELS / 2. You don't need to align or shift the presentation time to 0. I strongly recommend you
just use long initialTime = System.nanoTime() / 1000L to get the initial time and pass it to MediaCodec. Therefore, the next time you writing the samples, the presentation time should be initialTime + 1_000_000L * KEY_MAX_INPUT_SIZE / SAMPLE_RATE / NUMBER_OF_CHANNELS / 2 and so on.
This part is the biggest pit. Check the presentation time when writing the AAC encoded data to MediaMuxer, even though you have already set the presentation time when inputing the audio samples to MediaCodec. The presentation time for the AAC encoded data may not be incremental sometimes. You should record the last presentation time you write to MediaMuxer. If you found the misordered AAC data, adjust the presentation time by presentationTime = ++lastPresentationTime. Also, you may get some zero-presentation-time AAC data. Ignore them. Do not write them to MediaMuxer.
If the MediaMuxer has other tracks, make sure the presentation time
for each track is in the same range(allowing errors for seconds).
One AAC MediaCodec for one MediaMuxer. And do not reuse the output MediaFormat object.
Before executing MediaMuxer.stop(), stop calling your writeAudioSample method and send a EOS to MediaCodec via queueInputBuffer(index, 0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM). And drain the remaining AAC data from MediaCodec to write to MediaMuxer. Execute MediaMuxer.stop() and see what is happened.
When I first install the app onto my device, it works fine. Then, if I close it and re-open it, the app will crash with the below logcat message.
I don't think the first line regarding libwvm.so has anything to do with it, because that appears on install as well, but doesn't cause a crash.
I'm not sure what to do with this message, because as far as I can tell it doesn't point to anything in my code that I can try to fix.
I am following this tutorial to learn developing games with libGDX.
Any help appreciated. Thanks!
02-13 11:01:59.292 13140-13156/? E/WVMExtractor: Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
02-13 11:02:01.317 13140-13154/? A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x76a96000 in tid 13154 (GLThread 823)
02-13 11:02:01.424 3254-3254/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-13 11:02:01.425 3254-3254/? A/DEBUG: Build fingerprint: 'google/bullhead/bullhead:6.0.1/MMB29Q/2480792:user/release-keys'
02-13 11:02:01.426 3254-3254/? A/DEBUG: Revision: 'rev_1.0'
02-13 11:02:01.426 3254-3254/? A/DEBUG: ABI: 'arm64'
02-13 11:02:01.427 3254-3254/? A/DEBUG: pid: 13140, tid: 13154, name: GLThread 823 >>> com.mypackage.name <<<
02-13 11:02:01.427 3254-3254/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x76a96000
02-13 11:02:01.462 3254-3254/? A/DEBUG: x0 00000000be39c000 x1 0000000076a96000 x2 00000000000000a0 x3 0000000000000120
02-13 11:02:01.463 3254-3254/? A/DEBUG: x4 0000000000000000 x5 0000000000000000 x6 00000000be39c000 x7 0000000000000000
02-13 11:02:01.463 3254-3254/? A/DEBUG: x8 0000000000000000 x9 0000000000000000 x10 0000000000000120 x11 0000000000000000
02-13 11:02:01.463 3254-3254/? A/DEBUG: x12 0000000000000000 x13 0000007f8b9ad468 x14 0000007f8b9ad458 x15 0000007f8b9ad4b8
02-13 11:02:01.464 3254-3254/? A/DEBUG: x16 0000007f82329148 x17 0000007f900d4140 x18 0000000000000001 x19 0000000076a96120
02-13 11:02:01.464 3254-3254/? A/DEBUG: x20 00000000be39c000 x21 0000000000000001 x22 0000000000000120 x23 0000000000000120
02-13 11:02:01.464 3254-3254/? A/DEBUG: x24 0000000000000120 x25 0000000000000001 x26 0000000000000001 x27 0000000000000120
02-13 11:02:01.464 3254-3254/? A/DEBUG: x28 0000000076a96000 x29 0000007f8b9ace60 x30 0000007f81e57f74
02-13 11:02:01.464 3254-3254/? A/DEBUG: sp 0000007f8b9ace60 pc 0000007f900d4280 pstate 0000000020000000
02-13 11:02:01.468 3254-3254/? A/DEBUG: #00 pc 000000000001c280 /system/lib64/libc.so (memcpy+312)
02-13 11:02:01.469 3254-3254/? A/DEBUG: #01 pc 000000000025df70 /vendor/lib64/egl/libGLESv2_adreno.so (BltDevice::ExecFastCopyBlock(void*, void const*, unsigned int, unsigned int, unsigned int, unsigned int, BltRect const*, BltRect const*, int)+144)
02-13 11:02:01.650 3254-3254/? E/DEBUG: AM write failed: Broken pipe
02-13 11:02:01.675 4413-13173/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 112)
02-13 11:02:01.682 366-366/? E/lowmemorykiller: Error writing /proc/13140/oom_score_adj; errno=22
02-13 11:02:06.360 3321-3321/? E/QCALOG: [MessageQ] ProcessNewMessage: [LOWI-SERVER] unknown deliver target [OS-Agent]
02-13 11:02:32.344 6226-6226/? E/NetworkScheduler.SchedulerReceiver: Invalid parameter app
02-13 11:02:32.344 6226-6226/? E/NetworkScheduler.SchedulerReceiver: Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
02-13 11:02:32.945 7266-7266/? E/clatd: plat_prefix/dns(ipv4only.arpa) status = 7/No address associated with hostname
I don't think this is a logcat filtering issue. I selected "no filter" in the logcat and the message was the same, except for the last few lines which went like this instead of as above:
02-13 12:02:54.902 3254-3254/? E/DEBUG: AM write failed: Broken pipe
02-13 12:02:54.923 4413-17149/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 112)
02-13 12:02:54.928 4413-4459/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 60)
02-13 12:03:22.680 4413-5547/? E/native: do suspend true
02-13 12:03:22.688 6053-6302/? E/NxpTml: _i2c_write() errno : 5
02-13 12:03:22.688 6053-6302/? E/NxpTml: PN54X - Error in I2C Write.....
02-13 12:03:22.689 6053-6304/? E/NxpHal: write error status = 0x1ff
02-13 12:03:22.689 6053-6267/? E/NxpHal: write_unlocked failed - PN54X Maybe in Standby Mode - Retry
Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage.name"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
<activity
android:name="com.mypackage.name.AndroidLauncher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I think the most likely cause is that the OpenGL context is being released when the game goes into the background.
Lots of OpenGL based games use a class called glSurfaceView to manage the OpenGL surface, and by default, you get these sorts of crashes if you don't very carefully reinitialize all of your OpenGL objects after returning from suspend because they all get invalidated. In Ice Cream Sandwich, a function called setPreserveEGLContextOnPause was added to let you easily request that the OpenGL context is kept alive after your game goes into the background.
After some cursory research (so apologies if this is wrong) I believe libgdx uses it or something similar, but that it might be failing to work because you're not specifying a min or target sdk version in your manifest. Try adding a line like this to your manifest:
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="14" />
Documentation of the uses-sdk tag is here: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html