eclipse 由于 APK 文件无效,安装失败!- 安卓

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

Installation failed due to invalid APK file! - Android

androideclipseapk

提问by kousun12

So there were a couple of posts on this topic, but it looks like my log cat is totally different. Not sure what's going on. When I try to run on my device I get console log:

所以有几个关于这个主题的帖子,但看起来我的日志猫完全不同。不知道发生了什么。当我尝试在我的设备上运行时,我得到控制台日志:

[2012-07-17 14:50:56 - zrox] Uploading zrox.apk onto device '3134F748F94100EC'
[2012-07-17 14:50:56 - zrox] Installing zrox.apk...
[2012-07-17 14:50:57 - zrox] Installation failed due to invalid APK file!
[2012-07-17 14:50:57 - zrox] Please check logcat output for more details.
[2012-07-17 14:50:57 - zrox] Launch canceled!

And Logcat:

和 Logcat:

07-17 19:50:56.043: W/zipro(4533): Unable to open zip '/data/local/tmp/zrox.apk': Permission denied
07-17 19:50:56.043: D/asset(4533): failed to open Zip archive '/data/local/tmp/zrox.apk'
07-17 19:50:56.047: D/dalvikvm(252): WAIT_FOR_CONCURRENT_GC blocked 0ms
07-17 19:50:56.047: W/PackageParser(4533): Unable to read AndroidManifest.xml of /data/local/tmp/zrox.apk
07-17 19:50:56.047: W/PackageParser(4533): java.io.FileNotFoundException: AndroidManifest.xml
07-17 19:50:56.047: W/PackageParser(4533):  at android.content.res.AssetManager.openXmlAssetNative(Native Method)
07-17 19:50:56.047: W/PackageParser(4533):  at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
07-17 19:50:56.047: W/PackageParser(4533):  at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
07-17 19:50:56.047: W/PackageParser(4533):  at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:722)
07-17 19:50:56.047: W/PackageParser(4533):  at com.android.defcontainer.DefaultContainerService.getMinimalPackageInfo(DefaultContainerService.java:169)
07-17 19:50:56.047: W/PackageParser(4533):  at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:110)
07-17 19:50:56.047: W/PackageParser(4533):  at android.os.Binder.execTransact(Binder.java:367)
07-17 19:50:56.047: W/PackageParser(4533):  at dalvik.system.NativeStart.run(Native Method)
07-17 19:50:56.047: W/DefContainer(4533): Failed to parse package
07-17 19:50:56.047: W/ActivityManager(252): No content provider found for permission revoke: file:///data/local/tmp/zrox.apk
07-17 19:50:56.117: D/dalvikvm(252): GC_EXPLICIT freed 380K, 18% free 14176K/17159K, paused 4ms+6ms, total 70ms

I just installed a rom on my Nexus S for android 4.1. It worked when I had 4.0.3 yesterday. I do have the 4.1 SDK installed in eclipse, and android:targetSdkVersionis set to 16. I have also run a clean on the project. Nothing. Any ideas?

我刚刚在我的 Nexus S 上为 android 4.1 安装了一个 rom。当我昨天有 4.0.3 时它起作用了。我确实在 Eclipse 中安装了 4.1 SDK,并android:targetSdkVersion设置为 16。我还对项目进行了清理。没有。有任何想法吗?

采纳答案by WeldFire

I believe it is the rom you are running, I'm on a rom ported to the NS4G from Indirect. Here are his posts on XDA http://forum.xda-developers.com/search.php?searchid=51245494

我相信这是您正在运行的 rom,我在从 Indirect 移植到 NS4G 的 rom 上。这是他在 XDA 上的帖子http://forum.xda-developers.com/search.php?searchid=51245494

I have the same problem as well. :/

我也有同样的问题。:/

回答by itsmewajid

If you are running latest Siyah Kernel with JB, you can install Extweaks-> Go to Misc Set ADB Binary Mode to DEVELOPMENT ADB ..

如果您使用 JB 运行最新的 Siyah 内核,您可以安装 Extweaks-> 转到其他设置 ADB 二进制模式为 DEVELOPMENT ADB ..

回答by JBetts80

Remove your AVD and create another one.

删除您的 AVD 并创建另一个。

回答by gsps

The issue seems to be related to permissions. It could not open the archive, so the problem is not inside the manifest file.

该问题似乎与权限有关。它无法打开存档,所以问题不在清单文件中。

So, push it to the device using adb push location, go to the location in the device, change the permission for it to be executable, chmod 666 name.apk

因此,使用 adb push location 将其推送到设备,转到设备中的位置,将其更改为可执行权限, chmod 666 name.apk

then install, pm install name.apk.

然后安装,pm install name.apk。

回答by Víctor Martín

It's a ROM/Kernel security problem. With ADBD Insecure you can solve this issue.

这是一个 ROM/内核安全问题。使用 ADBD Insecure,您可以解决这个问题。

eu.chainfire.adbd - adbd insecure

eu.chainfire.adbd - adbd 不安全

回答by Phume

As you are not using an emulator, use adb to push the all to your device. This is the same as copying via USB, Bluetooth, or store to cloud and download using your device. Attempt to install it that way. If it works check your adb tools. If it does not work, then verify your apk using apksigneror jarsigner. For example;

由于您没有使用模拟器,请使用 adb 将所有内容推送到您的设备。这与通过 USB、蓝牙复制或存储到云并使用您的设备下载相同。尝试以这种方式安装它。如果有效,请检查您的 adb 工具。如果它不起作用,请使用apksignerjarsigner验证您的 apk 。例如;

apksigner verify <path to apk>

It should give you an idea of what's up. Or use _apkanalyzer to compare the failing apk to a working version. Either way you will start to understand why it is failing!

它应该让你知道发生了什么。或者使用 _apkanalyzer 将失败的 apk 与工作版本进行比较。无论哪种方式,您都会开始理解为什么它会失败!

All my best.

尽我所能。

回答by t0mm13b

Looking at the pertinent lines:

查看相关行:

07-17 19:50:56.047: W/PackageParser(4533): Unable to read AndroidManifest.xml of /data/local/tmp/zrox.apk
07-17 19:50:56.047: W/PackageParser(4533): java.io.FileNotFoundException: AndroidManifest.xml

Sounds like the Eclipse is messed up somewhere, try either increasing the memory footprint for the Eclipse.ini file or clean the project and build it again.

听起来 Eclipse 在某处搞砸了,尝试增加 Eclipse.ini 文件的内存占用或清理项目并重新构建它。

I know you may have tried this but its worth a shot!

我知道您可能已经尝试过这个,但值得一试!

Checking for updates for Eclipse itself, even the Android Development plugin software for Eclipse is, as of right now, available as version 20.

检查 Eclipse 本身的更新,即使是 Eclipse 的 Android 开发插件软件,截至目前,版本 20 也是可用的。

回答by tim

I have the same issue. It seems eclipse is not changing permissions on the apk. As a workaround you can do the following: use adb push to put your apk on the device then log into the shell and chmod 755 the apk.

我有同样的问题。eclipse 似乎没有更改 apk 的权限。作为一种解决方法,您可以执行以下操作:使用 adb push 将您的 apk 放在设备上,然后登录 shell 并 chmod 755 apk。