eclipse 未创建 Android APK 文件和 DEX 文件,没有警告或错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8015379/
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-09-19 17:17:43  来源:igfitidea点击:

Android APK file and DEX files not created, with no warning or error

androideclipsebin

提问by asaf

I've developed Android for a while now, using WIN7 64bit and Eclipse. Since I've tried to install the new ADT (1.5), I get a very weird phenomena. My build doesn't complete, and doesn't generate the APK file, nor the dex files. the class files are created, but nothing else.

我已经开发了一段时间的 Android,使用 WIN7 64 位和 Eclipse。自从我尝试安装新的 ADT (1.5) 以来,出现了一个非常奇怪的现象。我的构建没有完成,也没有生成 APK 文件,也没有生成 dex 文件。类文件被创建,但没有别的。

Also, there is no warning or error neither at the output or the Eclipse log.

此外,输出或 Eclipse 日志中都没有警告或错误。

The problem didn't occur immediately, but only after 1 or 2 good builds. Even if I create a simple project, the same thing happens.

问题不会立即出现,而是在 1 或 2 个良好构建后出现。即使我创建了一个简单的项目,也会发生同样的事情。

I didn't find anything useful on the net. I've re-downloaded Eclipse, the SDK, ADT, and started all over again, and got the JRE7 compatibility issue (function ... must override). I guess I got a Java SE update, and lost the old JRE. So I've downloaded JRE6, changed the compliance issue, and set it and the environment, and got back to square 1 :)

我在网上没有找到任何有用的东西。我重新下载了 Eclipse、SDK、ADT,然后重新开始,遇到了 JRE7 兼容性问题(功能……必须覆盖)。我想我得到了 Java SE 更新,并丢失了旧的 JRE。所以我下载了 JRE6,更改了合规性问题,并设置了它和环境,然后回到了第 1 部分:)

The build process starts, reaches 50% or 75%, suddenly stops, and no apk or dex files are created. Even for new empty helloWorld projects.

构建过程开始,达到 50% 或 75%,突然停止,并且没有创建任何 apk 或 dex 文件。即使对于新的空 helloWorld 项目。

Can someone please help? I have no idea how to proceed.

有人可以帮忙吗?我不知道如何继续。

Thanks

谢谢

回答by Ruslan

"With the new ADT plugins, it is the default behavior (to speed up build time) to not generate the .apk on every build..." as said in groups.google:

“使用新的 ADT 插件,默认行为(加快构建时间)不会在每次构建时生成 .apk ......”如 groups.google 中所述:

See http://groups.google.com/group/android-developers/browse_thread/thread/769628c57caa51ad/4cb2c6589995a9a5?pli=1

请参阅http://groups.google.com/group/android-developers/browse_thread/thread/769628c57caa51ad/4cb2c6589995a9a5?pli=1

You can enable automatic dex/apk building in the Eclipse settings: Window -> Preferences -> Android -> Build -> [] Skip packaging and dexing...

您可以在 Eclipse 设置中启用自动 dex/apk 构建:Window -> Preferences -> Android -> Build -> [] Skip Packaging and dexing...

// I tried to reinstall everything before finding this solution....

// 在找到此解决方案之前,我尝试重新安装所有内容....

回答by Viren

you can also simply change the jdk version forcing it to rebuild: right click on project -> properties -> Java COmpiler -> on right side pane, click on check box for "Enable project specific settings", then select Compiler compliance level: 1.6 or something else than current.

您也可以简单地更改 jdk 版本以强制其重建:右键单击项目 -> 属性 -> Java 编译器 -> 在右侧窗格中,单击“启用项目特定设置”复选框,然后选择编译器合规性级别:1.6或当前以外的其他东西。

It will rebuild and re-generate the apk and dex files. :) It helped me at least.

它将重建并重新生成 apk 和 dex 文件。:) 至少对我有帮助。

回答by Ranjit Aneesh

This problem wasted a lot of my time, I was getting the following error

这个问题浪费了我很多时间,我收到以下错误

adb is running normally. Could not find .apk!

adb 正常运行。找不到.apk!

I got this fixed by following 2 steps:

我通过以下两个步骤解决了这个问题:

  1. In Eclipse >Windows>Preferences>Android>Build, uncheck "Skip packaging and dexing ...."

  2. In the project properties>Android, I unchecked isLibrary.

  1. 在 Eclipse >Windows>Preferences>Android>Build 中,取消选中“Skip Packaging and dexing ....”

  2. 在项目属性>Android 中,我取消选中 isLibrary。

回答by Skitty

Just run it on your emulate (Right click your project -> Run As-> Android application) then check your bin folder.

只需在您的模拟器上运行它(右键单击您的项目 -> Run As-> Android 应用程序)然后检查您的 bin 文件夹。