解析自定义 apk 文件时出错
我今天开始研究 Android 编程,并创建了一个非常小的应用程序,用于播放 MP3。我使用的工具有Android SDK和eclipse。该代码在 Android 模拟器中完美执行,但在导出该代码并尝试在我的 Samsung Galaxy S2 上安装该 apk 后,我收到一条消息,告诉我解析文件时出现错误。
这是我手机的配置:Android v2.3.3,从未知来源安装=允许,USB调试=启用。我的项目的目标系统也已设置为 Android v2.3.3,AVD 的 CPU 架构已设置为 ARM (armeabi)。
我在导出时使用自定义梯形校正对 apk 进行了签名,因为我最初认为问题可能是调试密钥在真实设备上不起作用。
我尝试使用内部文件资源管理器和自定义资源管理器(ES 文件资源管理器)来安装该应用程序,但它不起作用。
关于如何让我的手机执行我的自定义应用程序的建议将不胜感激。 :)
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.
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).
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.
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.
Suggestions on how to make my phone execute my custom apps would be highly appreciated. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,由于它抱怨 .apk 文件,请尝试通过将扩展名重命名为 .zip 来打开 .apk 文件。如果您可以重命名该文件,并在 Windows 资源管理器中正常打开它,那么这应该表明文件本身没有损坏。
其次,我会尝试通过 USB 连接您的设备并使用命令
adb -d install "path-to-your-apk-file.apk"
进行安装。如果这不起作用,希望 adb 会输出更具描述性的内容,并且您可以使用错误更新您的问题。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.
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.我找到了自定义 apk 文件解析错误的答案 此处。删除 AndroidManifest.xml 中所需的 API 级别标签 android:minSdkVersion 解决了该问题。
I found the answer to the parsing error on custom apk files here. Removing the required API level tag android:minSdkVersion in AndroidManifest.xml solved the problem.