4

I have a sample project that has a gradle dependency to support library

compile 'com.android.support:support-v4:23.1.1'

When I run program this sometimes this exception occures:

Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.monkeyPatchExistingResources

I searched and find out I should add this dependency to gradle:

compile "com.android.support:support-core-utils:23.3.0" 

or compile "com.android.support:support-core-utils:24.2.0"

So I added dependency to gradle, but this time when I try to run app I get this error:

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

What should I do?

Hojjat
  • 815
  • 1
  • 10
  • 25

1 Answers1

1

android.util.ArrayMap is not from a library. That is part of the Android firmware, but only on API Level 19+ devices.

So, if your minSdkVersion is below 19, and you want to use the library implementation, switch to android.support.v4.util.ArrayMap.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • `referenced from method com.android.tools.fd.runtime.MonkeyPatcher` I feel like OP doesn't use it directly, it's just system that logs that. – azizbekian Apr 09 '17 at 12:36