Android [Dex Loader] Unable to execute dex:

[ Dex Loader] Unable to execute dex: java.lang.AssertionError. Check the Eclipse log for stack trace.

Conversion to Dalvik format failed: Unable to execute dex: java.lang.AssertionError. Check the Eclipse log for stack trace.

最近编译Android工程安装失败,网上说应该是jar包数量太多导致无法安装

以下是几种处理方法:

This is the DEX Error,I find the solutions by Google, one way is to modify the eclipse.ini, you can increase the memory allocated in eclipse.ini to this: -Xms128m -Xmx512m orsomething higher, but this didn’t work for me. After modify the eclipse.ini, I cannot start the eclipse. By StackOverflow, I find a solution:

eclipse.ini file must have -vm on first line and path on second line. don’t try to put everything into one line!
-vm
C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe

After add the -vm and the path in my eclipse.ini, I can start my Eclipse and the problem has been resolved.

Another way to solve the ” Conversion to Dalvik format failed: Unable to execute dex: null” problem is using the userlibrary, the concrete steps are as follows:
1. Right-click the project in Eclipse and select “Build Path -> Add Libraries…”.
2. Select User Library from the list and click Next.
3. Click the “User Libraries…” button.
4. Click “New…” in the User Libraries dialog.
5. Give the user library a name and select the System library checkboxand click OK.(一定要选中添加的system lib)


6. Highlight the newly added user library in the list and click the “Add JARs…” button and add the desired jar files.
7. Click OK on the User Libraries dialog.
8. Make sure the new user library is checked in the Add Library dialog and …


摘自http://www.cuteandroid.com/tips-for-android-developer-conversion-to-dalvik-format-failed-unable-to-execute-dex-null

根据以上总结我选用add user lib的形式

那到底为什么呢?我很是疑惑,几种添加的jar包的形式到底有什么不一样?

根据eclipse官方解释


Libraries tab options:
OptionDescription
Add JARsAllows you to navigate the workbench hierarchy and select JAR files to add to the build path.
Add External JARsAllows you to navigate the file system (outside the workbench) and select JAR files to add to the build path.
Add VariableAllows you to add classpath variables to the build path. Classpath variables are an indirection to JARs with the benefit of avoiding local file system paths in a classpath. This is needed when projects are shared in a team.
Variables can be created and edited in the Java > Build Path > Classpath Variables preference page.
Add LibraryAllows to add a predefined libraries like the JRE System Library. Such libraries can stand for an arbitrary number of entries (visible as children node of the library node)
Add Class FolderAllows to navigate the workbench hierarchy and select a class folder for the build path. The selection dialog also allows you to create a new folder.
Add External Class FolderAllows to navigate the file system (outside the workbench) and select a class folder for the build path. The selection dialog also allows you to create a new folder.
EditAllows you to modify the currently selected library entry or entry attribute
RemoveRemoves the selected element from the build path. This does not delete the resource.
Migrate JAR FileMigrate a JAR on the build path to a newer version. If the newer version contains refactoring scripts the refactoring stored in the script will be executed.

摘自http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-properties-build-path.htm

也就是说选中system lib的形式可以任意的添加jar的数量



  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值