Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Error "Conversion to Dalvik format failed with error 2"?

I am using flurry sdk in my application, before adding this flurry jar file it's working fine with out any errors. after adding flurry jar file in libs folder i am getting this error when i am compiling application in Eclipse.

trouble writing output: Too many methods: 70205; max is 65536. By package:
  5 android.accessibilityservice
  1 android.animation
  2 android.annotation
315 android.app
136 android.content
 28 android.content.pm
 47 android.content.res
 35 android.database
 14 android.database.sqlite
  8 android.gesture
113 android.graphics
 44 android.graphics.drawable
  1 android.graphics.drawable.shapes
 11 android.location
 27 android.media
 40 android.net
  1 android.net.http
  1 android.net.wifi
 96 android.os

[2013-03-04 16:42:13 - myapp] Conversion to Dalvik format failed with error 2

I have idea about how to solve error 1 but this is the new error for me unable to solve. i searched a lot did't get any solution for this.

when i remove this jar file it's working fine. if it has in libs not able to run the application. Why i am getting this error.? what is the sollution for this..

like image 201
RajaReddy PolamReddy Avatar asked Mar 04 '13 11:03

RajaReddy PolamReddy


1 Answers

Since the error is trouble writing output: Too many methods: 70205; max is 65536, "the sollution for this" is to reduce your method count by about 10%.

Usually this is the fault of having too many JARs with too many methods, though it is certainly conceivable that you wrote tens of thousands of methods yourself.

Try to find some JAR that you do not need and remove it. For example, you can use ProGuard to report the dead code within your app -- perhaps there is a dependent JAR of some library that the library ordinarily needs, but the way you happen to use the library is not needed.

ProGuard itself can also be used just to remove that dead code from your app, without all the normal obfuscation stuff. However, this is not part of the normal build process, so you'd have to somehow cook up an Ant script for this.

like image 134
CommonsWare Avatar answered Oct 13 '22 14:10

CommonsWare