无法安装apk

时间:2011-05-06 15:04:21

标签: android aapt

我正在使用Eclipse Ganymede和ADT 10.0插件以及Android3.0 SDK来构建我的应用程序。

当我尝试在手机上部署应用程序时,我会在控制台上写下以下内容:

[2011-05-06 10:35:38 - MyProject] Failed to install MyProject.apk on device 
[2011-05-06 10:35:38 - MyProject] (null)
[2011-05-06 10:35:38 - MyProject] Launch canceled! 

以下内容写入adb logcat

INFO/zipro(2499): Could not find end-of-central-directory in Zip
DEBUG/asset(2499): failed to open Zip archive '/data/local/tmp/MyProject.apk'
WARN/PackageParser(2499): Unable to read AndroidManifest.xml of /data/local/tmp/MyProject.apk
WARN/PackageParser(2499): java.io.FileNotFoundException: AndroidManifest.xml
WARN/PackageParser(2499):     at android.content.res.AssetManager.openXmlAssetNative(Native Method)
WARN/PackageParser(2499):     at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:523)
WARN/PackageParser(2499):     at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:491)
WARN/PackageParser(2499):     at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:597)
WARN/PackageParser(2499):     at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:126)
WARN/PackageParser(2499):     at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:100)
WARN/PackageParser(2499):     at android.os.Binder.execTransact(Binder.java:288)
WARN/PackageParser(2499):     at dalvik.system.NativeStart.run(Native Method)
ERROR/PackageManager(1579): Failed to handle start copy. Giving up
ERROR/PackageManager(1579): java.lang.NullPointerException
ERROR/PackageManager(1579):     at android.os.Parcel.readException(Parcel.java:1253)
ERROR/PackageManager(1579):     at android.os.Parcel.readException(Parcel.java:1235)
ERROR/PackageManager(1579):     at com.android.internal.app.IMediaContainerService$Stub$Proxy.getMinimalPackageInfo(IMediaContainerService.java:220)
ERROR/PackageManager(1579):     at com.android.server.PackageManagerService$InstallParams.handleStartCopy(PackageManagerService.java:5065)
ERROR/PackageManager(1579):     at com.android.server.PackageManagerService$HandlerParams.startCopy(PackageManagerService.java:4954)
ERROR/PackageManager(1579):     at com.android.server.PackageManagerService$PackageHandler.doHandleMessage(PackageManagerService.java:476)
ERROR/PackageManager(1579):     at com.android.server.PackageManagerService$PackageHandler.handleMessage(PackageManagerService.java:421)
ERROR/PackageManager(1579):     at android.os.Handler.dispatchMessage(Handler.java:99)
ERROR/PackageManager(1579):     at android.os.Looper.loop(Looper.java:143)
ERROR/PackageManager(1579):     at android.os.HandlerThread.run(HandlerThread.java:60)

当我尝试使用cmd提示符中的adb shell安装它时,我得到:

EOCD not found, not Zip
file 'D:\Workspace\MyProject\bin\MyProject.apk' is not a valid zip file

我尝试清理项目/删除gen文件夹/删除调试密钥库。什么都行不通;

请告知。

4 个答案:

答案 0 :(得分:1)

请参阅此thread they solved the issuecan't launch the application from eclipse

答案 1 :(得分:1)

我遇到了类似的问题,并在eclipse控制台中获得了类似的日志

[2011-12-06 10:35:38 - MyProject] Failed to install MyProject.apk on device 
[2011-12-06 10:35:38 - MyProject] (null)
[2011-12-06 10:35:38 - MyProject] Launch canceled!

但是清理和重建项目解决了这个问题。

答案 2 :(得分:0)

我有类似的问题。 我已将zip文件复制到源文件夹中:-e.g;包是com.example.demo

我把文件放在com文件夹中。 它向我展示了与你相同的错误。 我不确定你的情况,但在再次编写代码之前,只需检查整个项目是否出错了!

答案 3 :(得分:0)

似乎Ganymede与ADT 10.0不兼容

来自http://developer.android.com/sdk/requirements.html

支持的开发环境 Eclipse IDE

* Eclipse 3.5 (Galileo) or greater

  Note: Eclipse 3.4 (Ganymede) is no longer supported with the latest version of ADT.