I have a single-activity native application which uses the NativeActivity class. If the application crashes it is restarted immediately. I have been searching the Internet the whole day for this problem.
This happens when using any of the following (SIGSEGV is signalled):
- assert() from assert.h
- __android_log_assert() from android/log.h
- abort()
- pthread_exit()
I did some research:
https://stackoverflow.com/a/7387659
Didn't work, sending SIGKILL causes another SIGSEGV sent and the application is restarted.
https://stackoverflow.com/a/6121393/1374605
https://stackoverflow.com/a/2632649
I tried with only having one activity running. Am I missing something?
The restart also occurs when a JNI function (JNIEnv member) call throws and another JNI function is called without calling ExceptionClear() in between them. Has this something to do with the JVM?
Any ideas why the app is restarted after a crash and how can it be prevented?
UPDATE (logcat):
// Previous memory dump ended here
09-26 15:36:48.771: I/BootReceiver(2374): Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
09-26 15:36:48.781: I/ActivityManager(2374): Process net.devenec.devengine.sample (pid 4750) has died.
09-26 15:36:48.791: I/ActivityManager(2374): Start proc net.devenec.devengine.sample for activity net.devenec.devengine.sample/android.app.NativeActivity: pid=4763 uid=10075 gids={50075, 1028}
09-26 15:36:48.801: D/Zygote(1953): Process 4750 terminated by signal (11)
09-26 15:36:48.801: D/dalvikvm(4763): Late-enabling CheckJNI
09-26 15:36:48.826: I/dalvikvm(4763): Turning on JNI app bug workarounds for target SDK version 9...
09-26 15:36:48.841: W/Trace(4763): error opening trace file: No such file or directory (2)
// My code starts here
09-26 15:36:48.856: D/DevEngine(4763): [Application] Create
09-26 15:36:48.856: A/libc(4763): source/android/AndroidApplication.cpp:141: static void Platform::Application::create(ANativeActivity*): assertion "false" failed
09-26 15:36:48.856: A/libc(4763): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 4763 (evengine.sample)
09-26 15:36:48.956: I/DEBUG(1950): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-26 15:36:48.956: I/DEBUG(1950): Build fingerprint: 'samsung/m3xx/m3:4.1.2/JZO54K/I9305XXBMA6:user/release-keys'
09-26 15:36:48.956: I/DEBUG(1950): Revision: '2'
09-26 15:36:48.956: I/DEBUG(1950): pid: 4763, tid: 4763, name: evengine.sample >>> net.devenec.devengine.sample <<<
09-26 15:36:48.956: I/DEBUG(1950): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
// Memory dump starts here
EDIT:
About marking this question as a duplicate, I have explained why this is different right after the first link. The solution did not work in my case.
On my Galaxy S III (stock ROM), apps don't restart automatically after crash. So maybe whether they restart depends on which ROM you use?
Related
I have just started using MockK to mock all the Repositories / Services logic in an MVP-based app for UI tests.
I have some UI tests running a login activity where the Espresso inputs logins and passwords and using MockK I can fake various situation where the login fails or not.
All services & repositories are standard Kotlin object, so I am using mockkobject and every/coEvery to override and handle login requests & tasks.
On my physical devices, there are no issues with the tests at all, but as soon as I tried to run them on a emulator running Android P+ with recommended image, they constantly crash at random time. And on rare occasion they can survive long enough to work.
Looking at the logs, I got various SIGSEGV:
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 10425 (e.android.debug), pid 10425 (e.android.debug)
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc in tid 10968 (HeapTaskDaemon), pid 10957 (e.android.debug)
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 15050 (firebase-instal), pid 14972 (e.android.debug)
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xd in tid 8902 (Measurement Wor), pid 8858 (e.android.debug)
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22004 (Binder:21832_5), pid 21832 (e.android.debug)
But looking deeper into the logs I believe I found the culprit:
InputDispatcher: channel '9fa7335 my.company.com.android.debug/my.company.com.ui.login.LoginActivity(server)' ~ Channel is unrecoverably broken and will be disposed!
Looking for solutions, it seems this could happen due to memory leaks ?
In any case, I made sure to launch the activity under test in a #Before method where all the mocks occur while I am clearing such mocks and verifies in the #After method.
Clearly I believe the tests do work just fine but something must be wrong with Espresso or all the mocking that occurs...
[EDIT 1]
Further looking at prior logs, this could be the reason why there are memory leaks:
ActivityThread: Service com.google.android.gms.autofill.service.AutofillService has leaked IntentReceiver com.google.android.gms.autofill.smsretriever.TracingSmsBroadcastReceiver#ce00658 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Service com.google.android.gms.autofill.service.AutofillService has leaked IntentReceiver com.google.android.gms.autofill.smsretriever.TracingSmsBroadcastReceiver#ce00658 that was originally registered here. Are you missing a call to unregisterReceiver()?
I disabled the AutoFillService (set to none in the relevant settings section) on my emulator. This seemed to improve my tests success rate at the beginning, but they keep crashing after several runs.
Now the logs are not showing this leak anymore, though.
[EDIT 2]
Apparently this issue could be related to MockK as I was able to retrieve more logs:
2020-07-24 11:57:15.955 15767-15780/com.my.company.android.debug A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 15780 (HeapTaskDaemon), pid 15767 (e.android.debug)
2020-07-24 11:57:15.997 15962-15962/? E/crash_dump32: failed to detach from thread 15773: No such process
2020-07-24 11:57:15.997 15962-15962/? E/crash_dump32: failed to detach from thread 15778: No such process
2020-07-24 11:57:15.997 15962-15962/? E/crash_dump32: failed to detach from thread 15779: No such process
2020-07-24 11:57:15.997 15962-15962/? E/crash_dump32: failed to detach from thread 15780: No such process
// 20 more times of exact same line //
2020-07-24 11:57:16.007 15962-15962/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-07-24 11:57:16.007 15962-15962/? A/DEBUG: Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:user/release-keys'
2020-07-24 11:57:16.007 15962-15962/? A/DEBUG: Revision: '0'
2020-07-24 11:57:16.007 15962-15962/? A/DEBUG: ABI: 'x86'
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: Timestamp: 2020-07-24 09:57:16+0000
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: pid: 15767, tid: 15780, name: HeapTaskDaemon >>> com.my.company.android.debug <<<
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: uid: 10136
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: Cause: null pointer dereference
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: eax 00000000 ebx ef8a6c34 ecx 00000000 edx f310b604
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: edi f3200380 esi 00000000
2020-07-24 11:57:16.008 15962-15962/? A/DEBUG: ebp e659d9a8 esp e659d940 eip ef7d89f4
2020-07-24 11:57:16.027 2044-2135/? E/InputDispatcher: channel '342ebda com.my.company.android.debug/com.my.compan.android.ui.error.LoginActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
After further investigation, there is a 1-year-old issue on the Android Test Github repo showing the same problem (but issue is now closed): https://github.com/android/android-test/issues/352
A relevant issue at Mockk was opened here: https://github.com/mockk/mockk/issues/466
[EDIT 3]
I was exploring the alternative to go back to Mockito which has more history and more active development. It took a bit of time but I had no major issue migrating my UI tests to Mockito.
The results: well, at first the crash were completely gone. I could fire my tests run, 10, 20, 30 times without a hinch. At least on mobile.
However, on Android TV (still with a simulator), the crash reappeared rather quickly. And then on mobile as well, but way less often with the dreadful message from the InputDispatcher.
While setting up the migration to Mockito, I have noticed that Mockk shares the same restrictions & dependencies with Mockito when mocking on Android Test Instrumentation. I faced the same issues and the same difficulties.
So it led me to believe that neither of them are the culprit, but it could very well be the Android Instrumentation APIs.
I also noticed that manually rebooting the emulators greatly improved the situation.
This was in my stacktrace:
W Unexpected CPU variant for X86 using defaults: x86
ActivityThread W Package uses different ABI(s) than its instrumentation:
Switching to a 64 bit emulator fixed the problem.
I too have been running into this issue with my instrumentation test suite and also suspect MockK to be (at least partially) at fault.
This is far from a true solution, but I've noticed that running MY tests with Android Test Orchestrator greatly reduces the chance of random failure due to test process crash (caused by the above segfault). (If you are running tests with Firebase Test Lab emulators, this could be particularly helpful.)
Another bonus of using Orchestrator, it does a really good job of digging through the logs (in Firebase Test Lab) to find the root error if your test does fail in an Orchestrator process.
I'm not certain this will work well for everyone, but if it does, it likely indicates that MockK (if it truly is the source of this issue) isn't cleaning up fully and is leaking into other tests.
I had exactly the same case where my tests were crashing randomly on the Emulator with Process crashed error saying check the Logcat. There was SIGSEGV error on the Logcat but not always.
In my case it was com.linkedin.dexmaker:dexmaker-mockito-inline causing the random crashes. I had to add it to mock a Kotlin data class in Instrumentation tests which I didn't need after all. So removing this dependency solved my issue.
I recommend to investigate after which point your tests started crashing, then it will be easier to get to bottom of it.
I'm currently using the Skobbler SDK in an Android app to handle mapping and turn-by-turn direction tasks. One issue that came up was the desire to change to frequency at which audio advice is issued from the SDK so that we don't have too many instructions being fired off one after the other.
I found this answer to another question which explains the need to modify an advice_places.adv file which I was able to find within the SDK provided SKMaps.zip file.
The issue I'm experiencing seems to be related to how I re-archive the zip file once I've finished making changes to the advice_places.adv file. I'm working on a Mac and it seems that regardless of if I use the built-in "Compress..." context menu option or if I perform a zip operation via the command line similar to:
zip -vr SKMaps.zip SKMaps/ -x "*.DS_Store"; chmod +x SKMaps.zip
I still can't seem to load my app without it crashing during the Skobbler SDK map initialization process.
I've narrowed down the issue to it being a zip/unzip related issue since I can recreate the crash even if I don't modify any of the contents of the SKMaps.zip but only unzip and then rezip.
Here is a dump of the logs that I see when my app crashes.
SKMaps D SKMapViewHolder----#onResume
D SKMapSurfaceView----#onResume
D SKMapSurfaceView----#onResume preserve GL context is TRUE
WindowManager V Adding window Window{278f3a43 u0 com.company.mymapapp/com.company.mymapapp.activities.MainActivity} at 23 of 32 (before Window{246caca8 u0 SurfaceView})
V Adding window Window{1b0d49f9 u0 SurfaceView} at 23 of 33 (before Window{278f3a43 u0 com.company.mymapapp/com.company.mymapapp.activities.MainActivity})
SKMaps D MapRenderer----#onSurfaceCreated
D MapRenderer----#onSurfaceCreated LinInitialized = true
D MapRenderer---- #initGLView
SkobblerNG D set density JNI - before NG_SetScreenScale
D set density JNI - after NG_SetScreenScale
libc F Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 24828 (GLThread 44711)
btif_config_util D btif_config_save_file(L188): in file name:/data/misc/bluedroid/bt_config.new
DEBUG I *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I Build fingerprint: 'google/shamu/shamu:5.1/LMY47I/1767468:user/release-keys'
I Revision: '33696'
I ABI: 'arm'
I pid: 24493, tid: 24828, name: GLThread 44711 >>> com.company.mymapapp <<<
I signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
I r0 00000001 r1 00000000 r2 00000001 r3 00000029
I r4 a0edfcd0 r5 00000000 r6 a0edfc00 r7 a044a9b0
I r8 00000000 r9 a044a9d8 sl 00000001 fp 13250820
I ip 80000000 sp a044a978 lr 9e8d5efd pc 9e8d5f22 cpsr 600f0030
I backtrace:
I #00 pc 0018ef22 /data/app/com.company.mymapapp-1/lib/arm/libngnative.so (EarthSphere::SetupTextureInBufferFromTex(SK_WTEXTURE_ID&)+113)
I #01 pc 0018ff23 /data/app/com.company.mymapapp-1/lib/arm/libngnative.so (EarthSphere::Init(unsigned int, unsigned int)+190)
I #02 pc 0011dc7d /data/app/com.company.mymapapp-1/lib/arm/libngnative.so (MapRenderer::InitializeGlobeAndWorldTextures()+116)
I #03 pc 000fe1bd /data/app/com.company.mymapapp-1/lib/arm/libngnative.so (NG_InitializeGL+52)
I #04 pc 000e7fcf /data/app/com.company.mymapapp-1/lib/arm/libngnative.so (Java_com_skobbler_ngx_map_MapRenderer_initgl+14)
I #05 pc 0064b963 /data/dalvik-cache/arm/data#app#com.company.mymapapp-1#base.apk#classes.dex
I Tombstone written to: /data/tombstones/tombstone_07
ActivityManager W Force finishing activity 1 com.company.mymapapp/.activities.MainActivity
BootReceiver I Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
JavaBinder E !!! FAILED BINDER TRANSACTION !!!
WindowState I WIN DEATH: Window{23adbb9a u0 SurfaceView}
NetlinkEvent E NetlinkEvent::FindParam(): Parameter 'INTERFACE' not found
E NetlinkEvent::FindParam(): Parameter 'TIME_NS' not found
NetdConnector E Error handling '613 IfaceClass active (null)': java.lang.NumberFormatException: Invalid int: "(null)"
WindowState I WIN DEATH: Window{246caca8 u0 SurfaceView}
I WIN DEATH: Window{259e40bc u0 com.company.mymapapp/com.company.mymapapp.activities.IntroActivity}
I WIN DEATH: Window{278f3a43 u0 com.company.mymapapp/com.company.mymapapp.activities.MainActivity}
I WIN DEATH: Window{1b0d49f9 u0 SurfaceView}
Zygote I Process 24493 exited due to signal (11)
ActivityManager W Exception thrown during pause
W android.os.TransactionTooLargeException
W at android.os.BinderProxy.transactNative(Native Method)
W at android.os.BinderProxy.transact(Binder.java:496)
W at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:704)
W at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:825)
W at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2726)
W at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2583)
W at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2497)
W at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11500)
W at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11397)
W at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12081)
W at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:11592)
W at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
lowmemorykiller E Error opening /proc/24493/oom_score_adj; errno=2
Process com.company.mymapapp (PID: 24493) ended
If anyone has any information as to the preferred method of generating a zip file on a Mac for use with the Skobbler SDK in this fashion, I would appreciate any guidance.
Thank you!
Keith
I've had the same issue (I did the zipping/unzipping manually) - I did not get to the bottom of the problem but the trick is not to zip the SkMaps folder (that you get when unzipping) but the content of that folder (all the subfolders) in an archive named SkMaps.zip (go in the unpacked folder, SKMaps, select all the folder and compress them to an SKMaps.zip.
I'm not sure if this is Mac specific or zip specific. The SDK expects that when unzipping SKMaps.zip it will find a number of folders, but when you compress the SKMaps folder directly you end up with an archive that has as root folder a folder named SkMaps (which is wrong) and only inside that folder the correct folder structure.
I have created an Android emulator with OS(6.0) and when the emulator starts i launch directly the "Browser" app and get a crash.
Here are some logs :
W/System(1617): ClassLoader referenced unknown path: /system/app/webview/lib/arm
E/ActivityThread(1617): Failed to find provider info for com.google.settings
### WebView Version 44.0.2403.119 (code 246011900)
Fatal signal 6 (SIGABRT), code -6 in tid 1667 (GpuThread)
SELinux: Loaded file_contexts contexts from /file_contexts.
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk_phone_armv7/generic:6.0/MRA44C/2166767:eng/test-keys'
Revision: '0'
ABI: 'arm'
pid: 1617, tid: 1667, name: GpuThread >>> com.android.browser <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:gl_surface_android.cc(58)] Check failed: kGLImplementationNone != GetGLImplementation() (0 vs. 0)
does anyone know something about that?
Please find the tombstone file that contains the full crash log :
Tombstone01
Resolved by checking "Use GPU Host" when creating the emulator.
On Android (4.3), if I start logging into Google Play Services and cancel with the back button, and then start logging into Facebook, my app immediately crashes with this output:
06-05 18:02:43.321 6393 6531 F chromium_net:
external/chromium/base/threading/thread_local_posix.cc:18:
[0605/180243:FATAL:thread_local_posix.cc(18)] Check failed: error == 0
(11 vs. 0)
06-05 18:02:43.321 6393 6531 F libc : Fatal signal 11 (SIGSEGV)
at 0xdeadbaad (code=1), thread 6531 (WebViewCoreThre)
06-05 18:02:43.331 6393 6393 D WebView : loadUrlImpl: called
06-05 18:02:43.341 2345 2472 D STATUSBAR-StatusBarManagerService:
manageDisableList what=0x0 pkg=WindowManager.LayoutParams
06-05 18:02:43.361 2345 2473 D LockPatternUtils: isPcwEnable = null
06-05 18:02:43.361 1935 1996 I SurfaceFlinger: id=3595 createSurf
(1x1),1 flag=4, MoginActivi
06-05 18:02:43.366 2345 5574 D LockPatternUtils: isPcwEnable = null
06-05 18:02:43.381 5714 5714 I DEBUG : * * ***
06-05 18:02:43.381 5714 5714 I DEBUG : Build fingerprint:
'samsung/m0xx/m0:4.3/JSS15J/I9300XXUGNB6:user/release-keys'
06-05 18:02:43.381 5714 5714 I DEBUG : Revision: '12'
06-05 18:02:43.381 5714 5714 I DEBUG : pid: 6393, tid: 6531, name:
WebViewCoreThre >>> com.XX.Test <<<
06-05 18:02:43.381 5714 5714 I DEBUG : signal 11 (SIGSEGV), code 1
(SEGV_MAPERR), fault addr deadbaad
06-05 18:02:43.381 2345 5574 D LockPatternUtils: isPcwEnable = null
06-05 18:02:43.391 2345 2473 D LockPatternUtils: isPcwEnable = null
06-05 18:02:43.736 2588 2588 D STATUSBAR-NetworkController:
onSignalStrengthsChanged signalStrength=SignalStrength: 9 -1 -1 -1 -1
-1 -1 99 -140 -20 -200 -1 2147483647 gsm|lte 0x3 level=3
06-05 18:02:44.211 5714 5714 I DEBUG : r0 00000027 r1
00000000 r2 00000000 r3 deadbaad
If I start the Facebook login and cancel, and then start the Google Play Games login, O also get the crash.
I'm using Unity 4.6.5, Facebook SDK 6.2.2, and Google Play Games Plugin for Unity 0.9.20. Both logins work fine, unless if I attempt them both.
How do I go about fixing this?
You can see in your crash this line:
06-05 18:02:43.321 6393 6531 F libc : Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 6531 (WebViewCoreThre)
I'd refer you here where you can see:
0xDEADBAAD ("dead bad") is used by the Android libc abort() function when native heap corruption is detected.
You'll need to provide a lot more info about your app and crash for this to be solved properly. I'd look into the WebView that you are opening (or maybe Unity is creating for you?). Please generate a bug report after the crash (It's in the Developers Settings) and email it to yourself, there you might find a Tombstone which might give you a lot more info (if you have the tombstone dereferencer, or whatever it's called, I forget).
A wild guess: Do you have a 'on complete' callback that does something to your UI?
Even if you abort/go back the process will continue unless you do something to cancel it. If it continues and the view is changed, your onComplete-method might access variables that are no longer available since you changed your view.
Am continuously getting, this errors in logcat
DexOpt: not resolving ambiguous class 'Lorg/apache/http/client/utils/URLEncodedUtils;'
12-07 05:26:01.085: ERROR/dalvikvm(4620): LinearAlloc exceeded capacity (5242880), last=1092
12-07 05:26:01.085: ERROR/dalvikvm(4620): VM aborting
12-07 05:26:01.187: INFO/DEBUG(2373): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-07 05:26:01.187: INFO/DEBUG(2373): Build fingerprint: 'samsung/SGH-T849/SGH-T849/SGH-T849:2.2/FROYO/UVJJB:user/release-keys'
12-07 05:26:01.187: INFO/DEBUG(2373): pid: 4620, tid: 4620 >>> /system/bin/dexopt <<<
12-07 05:26:01.187: INFO/DEBUG(2373): signal 11 (SIGSEGV), fault addr deadd00d
............etc
12-07 05:26:01.347: INFO/dalvikvm(2494): threadid=3: reacting to signal 3
12-07 05:26:01.358: INFO/dalvikvm(2494): Wrote stack traces to '/data/anr/traces.txt'
12-07 05:26:01.551: INFO/dalvikvm(2578): threadid=3: reacting to signal 3
12-07 05:26:02.866: ERROR/dalvikvm(4581): Failed to write stack traces to /data/anr/traces.txt (1370 of 2089): No such file or directory
12-07 05:26:25.976: ERROR/installd(2383): dexopt failed on '/data/dalvik-cache/data#app#com.check.careerbuilder-1.apk#classes.dex' res = 11
12-07 05:26:26.050: WARN/PackageManager(2494): Package couldn't be installed in /data/app/com.check.careerbuilder-1.apk
and While at Console
Installation error: INSTALL_FAILED_DEXOPT
Please check logcat output for more details.
Launch canceled!
I tried, cleaning the project, restarting device, adb killing and starting server,
and I found WipeUserData to be checked , but how to wipeuserdata for realdevice?
How to resolve this issue and install my apk on samsung tablet?
It's a limitation in Dalvik triggered on unusually complex interface hierarchies.
http://code.google.com/p/android/issues/detail?id=22586
See the details for ideas on working around. Simple answer might be to try using different libraries that are less complex.
A fix has been merged into Android AOSP.
https://android-review.googlesource.com/#/c/30900/
One potential solution is to use Proguard to trim any unused method/classes from your app.
If you are using libraries this can quite significantly cut down the size of the app and the number of objects that need to be allocated thereby sidestepping the problem (at least up to a certain size app).