eclipse 解析自定义 apk 文件时出错

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

Error when parsing a custom apk file

androideclipsesamsung-mobile

提问by beta

I started to look into Android programming today and created a very small app that is supposed to play MP3s. The tools I used where the Android SDK and eclipse. The code executed flawlessly in the Android emulator but after exporting it and attempting to install the apk on my Samsung Galaxy S2 I received a message telling me there was an error when parsing the file.

我今天开始研究 Android 编程,并创建了一个非常小的应用程序,可以播放 MP3。我用的工具哪里有Android SDK 和eclipse。代码在 Android 模拟器中完美执行,但在导出它并尝试在我的三星 Galaxy S2 上安装 apk 后,我收到一条消息,告诉我解析文件时出错。

Here is my phone's configuration: Android v2.3.3, installation from unknown sources = allowed, USB-Debugging = enabled. The target system for my project has been set to Android v2.3.3 as well and the CPU architecture of the AVD has been set to ARM (armeabi).

这是我手机的配置:Android v2.3.3,未知来源安装=允许,USB调试=启用。我的项目的目标系统也已设置为Android v2.3.3,AVD的CPU架构已设置为ARM(armeabi)。

I signed the apk using a custom keystone when exporting it, as I initially thought the problem might be a debug key which wouldn't work on real devices.

我在导出时使用自定义 keystone 对 apk 进行了签名,因为我最初认为问题可能是调试密钥在真实设备上不起作用。

I attempted to install the app using both, the internal file explorer and a custom explorer (ES File Explorer) but it didn't work for.

我尝试使用内部文件资源管理器和自定义资源管理器(ES 文件资源管理器)安装该应用程序,但它不起作用。

Suggestions on how to make my phone execute my custom apps would be highly appreciated. :)

关于如何让我的手机执行我的自定义应用程序的建议将不胜感激。:)

回答by Samuel

First, since it's complaining about the .apk file, try opening the .apk file by renaming the extension to .zip. If you can rename the file, and open it normally in Windows Explorer, then that should indicate the file itself isn't corrupt.

首先,由于它在抱怨 .apk 文件,尝试通过将扩展名重命名为 .zip 来打开 .apk 文件。如果您可以重命名文件,并在 Windows 资源管理器中正常打开它,那么这应该表明文件本身没有损坏。

Secondly, I would try installing by connecting your device via usb and using the command adb -d install "path-to-your-apk-file.apk". If this doesn't work, hopefully adb will spit out something more descriptive, and you can update your question with the error.

其次,我会尝试通过 USB 连接您的设备并使用命令进行安装adb -d install "path-to-your-apk-file.apk"。如果这不起作用,希望 adb 会吐出更具描述性的内容,并且您可以使用错误更新您的问题。

回答by beta

I found the answer to the parsing error on custom apk files here. Removing the required API level tag android:minSdkVersionin AndroidManifest.xmlsolved the problem.

我找到了答案,定制的apk文件的解析错误这里。取出所需的API级别标记安卓的minSdkVersionAndroidManifest.xml中解决了这个问题。