为什么我更新的 Eclipse / Android 设置不再构建我的 APK?

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

Why is my updated Eclipse / Android setup not building my APK anymore?

androideclipseclasspathapkeclipse-indigo

提问by Andy Weinstein

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.

我使用 3.6.2 和版本 11 的 SDK 工具进行了有效的 Eclipse 设置,并且它构建我的主项目已经有一段时间了。

For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).

对于不同的项目,我认为我需要将我的 SDK 升级到最新最好的——此时 API 14 (ICS 4.0)。

I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.

我什至无法重建我经历的步骤,但发生的事情是我的项目似乎会构建,但我会看到它会说它正在跳过编译后步骤,最后我将没有 APK。

I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.

我还注意到它更新了我的 .classpath 以便输出路径是 bin/classes 而不是 .bin。

Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.

在此过程中,我尝试将 Eclipse 更新到最新版本(Indigo 3.7.1),但这没有帮助。

回答by Andy Weinstein

I solved the problem eventually with help from this post on the Google Android forum:

我最终在 Google Android 论坛上的这篇文章的帮助下解决了这个问题:

http://code.google.com/p/android/issues/detail?id=21031

http://code.google.com/p/android/issues/detail?id=21031

For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post) "I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."

对我个人而言,最大的问题似乎解决如下(来自论坛帖子中的评论 25)“我似乎解决了在使用运行/调试之前不会自动构建 .apk 文件的问题(评论 #10、#11等)。转到 Windows -> 首选项 -> Android -> 构建并取消选中“在导出或启动之前跳过打包和 dexing”,然后重新启动 Eclipse。对我有用。

But there is other useful material there. Different people with different projects seem to have different problems with this setup.

但是那里还有其他有用的材料。不同项目的不同人似乎对这个设置有不同的问题。

I still don't understand the change in the classpath, but it doesn't seem to matter.

我仍然不明白类路径的变化,但这似乎无关紧要。

In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:

此外,我在 Stackoverflow 中找到了有关使用 Eclipse Indigo 安装 ADT 的讨论,这很有帮助:

Eclipse Indigo - Cannot install Android ADT Plugin

Eclipse Indigo - 无法安装 Android ADT 插件

I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:

我还发现我猜是由于各种卸载/重新安装,出于某种原因它停止从源中排除我的 .svn 目录。这篇 Stackoverflow 帖子对此很有帮助:

Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?

为什么 Eclipse 试图将我的 .svn 文件夹从 src 复制到 bin,我该如何让它停止?

Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse - Zap it if you really want to start fresh.

最后:关于真正卸载 Eclipse 的提示 - 每个人都说没有卸载,也没有,但是 Eclipse 在您的主目录(在 Windows 7 中的 c:\users\ 下)中有一个名为 .eclipse 的目录- 如果您真的想重新开始,请关闭它。

In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.

此外,对于不太极端的措施,Eclipse 内部有 Project->Clean,您可以使用“eclipse -clean”调用 eclipse 以获得额外的清洁效果。不知道是什么,但一路上各种乐于助人的人建议尝试解决问题。

Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine. See this post for somebody who had similar experience:

是的 - 当我第一次安装 Indigo 并尝试构建时,我收到一个警告,说我的 Java 编译器合规性级别不符合标准,这根本不是真的 - 我的机器上只安装了 Java 1.6。有类似经历的朋友可以看看这个帖子:

http://marakana.com/forums/android/general/374.html

http://marakana.com/forums/android/general/374.html

For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!

对我来说,只需转到 Project、Properties、Java Compiler,然后单击 Configure Workspace Settings,然后单击对话框中的 Ok。不需要真正改变任何东西。只是表明一切正常!

Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.

最终,我确实清除了我的 Eclipse 和 Android 安装(包括前面提到的 .eclipse 目录,并且在您的主目录中还有一个 .android 目录,如果卸载 Android SDK 工具没有这样做,您可能想要删除该目录 - 这实际上可卸载)。从头开始安装所有东西,然后使用上面提供的附加信息,现在它正在构建我的 APK。

I hope this saves somebody the hours I spent getting my build back in shape.

我希望这可以节省我花在恢复体型上的时间。