问题
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..
回答1:
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.
回答2:
I was having that error because I was including Google Apis into my project.
回答3:
What I have observed is, we should not put jars file directly inside a folder like
libs/x.jar
When I created a sub-folder within the libs or any folder for that sake like
libs/temp/x.jar
You can load how many jar files in that temp folder. That way I was able to avoid the error. It just need not be libs folder itself. The name can be anything.
This has to be done only if the jar files are high in number. Otherwise you can put directly in the libs folder.
来源:https://stackoverflow.com/questions/15200286/android-error-conversion-to-dalvik-format-failed-with-error-2