简体   繁体   English

使用ADT 23.0.4在Android 4.4.1 for Android中“导出应用程序失败”

[英]“Failed to export application” in Eclipse 4.4.1 for Android with ADT 23.0.4

When I want to export my Android app from Eclipse, the export process starts normally but after a few seconds (when the whole process should actually take a minute) it fails. 当我想从Eclipse导出我的Android应用程序时,导出过程正常启动,但几秒钟后(当整个过程实际上需要一分钟时)它会失败。 The following error message appears: 出现以下错误消息:

Failed to export application 无法导出应用程序

That's all Eclipse is telling me. 这就是Eclipse所告诉我的全部内容。 I'm using Ecliipse 4.4.1 with the Android Development Toolkit 23.0.4.1468518. 我正在使用Ecliipse 4.4.1和Android Development Toolkit 23.0.4.1468518。

When I then right-click the app, choose "Android Tools" and then "Export Unsigned Application Package", it fails again, but with more verbose error messages: 当我然后右键单击该应用程序,选择“Android工具”,然后选择“导出未签名的应用程序包”时,它再次失败,但有更详细的错误消息:

在此输入图像描述

As you can see, it says: 如你所见,它说:

'Android Release Export' has encountered a problem. 'Android Release Export'遇到了问题。

Failed to export application 无法导出应用程序

And strangely, it lists a file bin/$1$1.class which apparently cannot be found. 奇怪的是,它列出了一个文件bin/$1$1.class ,显然无法找到。 There's no obvious reason why this file shouldn't be found, however. 但是,没有明显的理由说明为什么不能找到这个文件。

Only when I delete folders bin and gen and then clear the project, it works. 只有当我删除文件夹bingen然后清除项目时,它才有效。 But only once -- and after every successful run on the device or export to an APK, I have to repeat the step described before. 但只有一次 - 在设备上每次成功运行或导出到APK后,我都必须重复之前描述的步骤。

Any ideas why this happens? 任何想法为什么会这样? Thanks a lot in advance! 非常感谢提前!

I had multiple issues with Export Application Package in Eclipse before. 我以前在Eclipse中有过Export Application Package的多个问题。 Sometimes switching Project - Build Automatically off helped, something deleting bin folder and cleaning project helped. 有时切换项目 - 自动生成关闭帮助,删除bin文件夹和清理项目的帮助。 But the best and always working solution I found was a migration to Ant build. 但我找到的最好的,始终可行的解决方案是迁移到Ant构建。

If you are interested, here is how it works. 如果您有兴趣,这是它的工作原理。 It was surprisingly simple . 这简直太简单了 Navigate into project's folder and execute 导航到项目的文件夹并执行

android update project -p .

It will created a build.xml file. 它将创建一个build.xml文件。 Repeat same for all used library projects, if any. 对所有使用的库项目重复相同的操作(如果有)。 And you are done. 你完成了。 Now calling ant release will create released apk-file. 现在调用ant release将创建已发布的apk文件。 If you want app to be signed, add key.store , key.alias , key.store.password and key.alias.password to local.properties file inside your project. 如果要对应用程序进行签名,请将key.storekey.aliaskey.store.passwordkey.alias.password到项目内的local.properties文件中。 Now you can build new apk with a single command. 现在,您可以使用单个命令构建新的apk。 Hope this can help you. 希望这可以帮到你。

Try downgrading ADT. 尝试降级ADT。

Also, check your res folder. 另外,检查您的res文件夹。 Sometimes duplication of folder may cause this error. 有时复制文件夹可能会导致此错误。 For example, suppose u have two sub directories with same name in assets folder, this error may occur. 例如,假设您在assets文件夹中有两个具有相同名称的子目录,则可能会发生此错误。 Check your application folder thoroughly in the explorer 在资源管理器中彻底检查应用程序文件夹

  1. Refresh the project (project right-click > refresh) 刷新项目(项目右键单击>刷新)
  2. Clean the project (Window 'Project' Menu > Clean...) 清理项目(窗口'项目'菜单>清洁......)
  3. Fix Android Project (project right-click > Android Tools > Fix Project Properties)erties. 修复Android项目(项目右键单击> Android工具>修复项目属性)erties。

ADT is not perfect and sometimes it gets random errors that are fixed with a general clean-up. ADT并不完美,有时会出现随机错误,通过一般清理来修复。

First clean your project then deselect "Build Automatically" option from Project/Build Automatically. 首先清理项目,然后从“项目/构建自动”中取消选择“自动构建”选项。 Now try to export it. 现在尝试导出它。

首先从工作区删除.meta文件夹,重新启动eclipse导入应用程序,然后重试。

I had the same problem after I had imported a project that was originally built on a Windows computer onto my Mac. 我将最初在Windows计算机上构建的项目导入到Mac后,我遇到了同样的问题。 I eventually noticed that my .project file had references to a "C:\\" drive that did not exist in my current environment. 我最终注意到我的.project文件引用了当前环境中不存在的“C:\\”驱动器。 For me the references were a result of "linked folders" that used absolute paths instead of project or workspace variables. 对我来说,引用是“链接文件夹”的结果,它使用绝对路径而不是项目或工作空间变量。 Once I fixed those, the export process worked. 一旦我修复了这些,导出过程就有效了。

转到您的工作区,只需复制项目文件并将其传输到您想要的计算机,然后使用导入工具导入它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM