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官方解释
Option | Description |
---|---|
Add JARs | Allows you to navigate the workbench hierarchy and select JAR files to add to the build path. |
Add External JARs | Allows you to navigate the file system (outside the workbench) and select JAR files to add to the build path. |
Add Variable | Allows 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 Library | Allows 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 Folder | Allows 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 Folder | Allows 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. |
Edit | Allows you to modify the currently selected library entry or entry attribute |
Remove | Removes the selected element from the build path. This does not delete the resource. |
Migrate JAR File | Migrate 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