简体   繁体   English

Android错误“转换为Dalvik格式失败,错误2”?

[英]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. 我在我的应用程序中使用flurry sdk,在添加这个flurry jar文件之前它没有任何错误。 after adding flurry jar file in libs folder i am getting this error when i am compiling application in Eclipse. 在libs文件夹中添加flurry jar文件后,当我在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. 我知道如何解决error 1但这是我无法解决的新错误。 i searched a lot did't get any solution for this. 我搜索了很多没有得到任何解决方案。

when i remove this jar file it's working fine. 当我删除这个jar文件它工作正常。 if it has in libs not able to run the application. 如果它在libs中无法运行应用程序。 Why i am getting this error.? 为什么我收到此错误。? what is the sollution for this.. 什么是溶剂...

Since the error is trouble writing output: Too many methods: 70205; max is 65536 由于错误trouble writing output: Too many methods: 70205; max is 65536trouble writing output: Too many methods: 70205; max is 65536 trouble writing output: Too many methods: 70205; max is 65536 , "the sollution for this" is to reduce your method count by about 10%. trouble writing output: Too many methods: 70205; max is 65536 ,“此溶剂”可将您的方法计数减少约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. 通常这是因为有太多JAR并且有太多方法的错误,尽管你自己可以想象自己编写了数以万计的方法。

Try to find some JAR that you do not need and remove it. 尝试找到一些你不需要的JAR并将其删除。 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报告应用程序中的死代码 - 也许库中通常需要某个库的依赖JAR,但不需要您使用库的方式。

ProGuard itself can also be used just to remove that dead code from your app, without all the normal obfuscation stuff. ProGuard本身也可以用来从你的应用程序中删除那些死代码,而不需要所有正常的混淆。 However, this is not part of the normal build process, so you'd have to somehow cook up an Ant script for this. 但是,这不是正常构建过程的一部分,因此您必须以某种方式为此编写Ant脚本。

我遇到了这个错误,因为我将Google Apis包含在我的项目中。

What I have observed is, we should not put jars file directly inside a folder like 我观察到的是,我们不应该将jars文件直接放在文件夹中

libs/x.jar

When I created a sub-folder within the libs or any folder for that sake like 当我在libs或任何文件夹中创建一个子文件夹时,就像那样

libs/temp/x.jar

You can load how many jar files in that temp folder. 您可以加载该临时文件夹中的jar文件数。 That way I was able to avoid the error. 这样我就能避免这个错误。 It just need not be libs folder itself. 它只是不需要是libs文件夹本身。 The name can be anything. 这个名字可以是任何东西。

This has to be done only if the jar files are high in number. 只有在jar文件数量很多时才必须这样做。 Otherwise you can put directly in the libs folder. 否则你可以直接放在libs文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM