Android 转换为 Dalvik 格式失败:无法执行 dex:java.nio.BufferOverflowException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20397385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:47:17  来源:igfitidea点击:

Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException

android

提问by saa

I am getting following exception when I am trying to run my Android project.

当我尝试运行我的 Android 项目时出现以下异常。

Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException

转换为 Dalvik 格式失败:无法执行 dex:java.nio.BufferOverflowException

Currently now I am using ADT version 22.3. My project target is API level-15. I tried to add Support library in Android tools, but problem not resolved.

目前我正在使用 ADT 22.3 版。我的项目目标是 API 级别 15。我尝试在 Android 工具中添加支持库,但问题未解决。

回答by Rohit Mandiwal

the key is to set target=android-19from project.propertiesand android:targetSdkVersion="19"same to 19. This has worked for me.

关键是target=android-19project.properties和设置android:targetSdkVersion="19"为 19。这对我有用。

回答by umair.ali

Its a big mess... Following way did the trick for me...

真是一团糟......下面的方式对我有用......

Right click your project in eclipse -> Android Tools -> Add Support Library

在 Eclipse 中右键单击您的项目 -> Android 工具 -> 添加支持库

Then click Accept Licenseand click install.

然后单击Accept License并单击install

回答by ahmedibrahim085

I had the same problem and I used these methods

我遇到了同样的问题,我使用了这些方法

1- Downgrading to Android SDK build tools 18.1.1

1- 降级到 Android SDK 构建工具 18.1.1

2- Adding the support library. (if it already there, try removing it and adding it again, Right click on project -> Android tools -> Add support library)

2- 添加支持库。(如果它已经存在,请尝试将其删除并再次添加,右键单击项目 -> Android 工具 -> 添加支持库)

you can follow the detailed instructions here http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack-trace/

您可以按照此处的详细说明进行操作 http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack -痕迹/

回答by troutit

Is this the same problem as Android dex gives a BufferOverflowException when building? Updating to the 19.0.1 Build-tools (as described in the linked post) fixed this problem for me.

这是否与Android dex 在构建时给出 BufferOverflowException 的问题相同?更新到 19.0.1 Build-tools(如链接帖子中所述)为我解决了这个问题。

回答by Arunkumar

Browse through your eclipse Folder-> Open Eclipse Folder Open eclipse.ini Change -Xms40m And -Xmx384m TO -Xms512m And -Xmx512m

浏览您的 eclipse 文件夹-> 打开 Eclipse 文件夹打开 eclipse.ini 将-Xms40m 和 -Xmx384m更改 为 -Xms512m 和 -Xmx512m

Click Save

点击保存

回答by Sumit

No need to downgrade. You can fix the error by editing the manifest file or project properties. Add following line.

没必要降级。您可以通过编辑清单文件或项目属性来修复错误。添加以下行。

sdk.build.tools=18.1.1

replace 18.1.1 with your targetsdk in manifest.

用清单中的 targetsdk 替换 18.1.1。

Step by step detail on :- http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack-trace/

分步详细信息:- http://techlovejump.in/2013/11/how-to-solve-unable-to-execute-dex-java-nio-bufferoverflowexception-check-the-eclipse-log-for-stack -痕迹/

回答by Ahamed Ishak

I Update the project.properties file. I put sdk.build.tools=19.0.1 in property file. And set the minimum SDK version to 14

我更新了 project.properties 文件。我将 sdk.build.tools=19.0.1 放在属性文件中。并将最低 SDK 版本设置为 14

回答by Chuy47

it happened to me when my emulator had set a high Ram value, i changed the emulator RAM value to 768 and then it worked

当我的模拟器设置了一个高 RAM 值时,它发生在我身上,我将模拟器 RAM 值更改为 768 然后它工作了

回答by mvmanh

I've dealt with this problem when using Sherlock ActionBar library in my project. You could do the following step, it's work for me.

我在我的项目中使用 Sherlock ActionBar 库时处理过这个问题。您可以执行以下步骤,这对我有用。

  1. Right click to your project, select properties.
  2. A dialog will show up, select 'Java build path' on the left menu.
  3. Remove 'Android dependencies' and 'Android private libraries' on the right panel then click OK
  4. Clean your project (select menu Project --> Clean)
  5. Right click your project, select Android Tools -> Fix project properties
  6. Clean project once again.
  7. Restart your computer
  8. Open eclipse and Export apk
  1. 右键单击您的项目,选择属性。
  2. 将出现一个对话框,在左侧菜单中选择“Java 构建路径”。
  3. 删除右侧面板上的“Android 依赖项”和“Android 私有库”,然后单击“确定”
  4. 清理您的项目(选择菜单 Project --> Clean)
  5. 右键单击您的项目,选择 Android 工具 -> 修复项目属性
  6. 再次清理项目。
  7. 重启你的电脑
  8. 打开eclipse并导出apk

Hope that will help you.

希望这会帮助你。