简体   繁体   English

在apk中包含资源时,Android上是否显示“未安装应用程序”?

[英]“Application not installed” on Android when including resources in the apk?

I'm developing a graphical application for Android tablets but I've recently started having a strange problem. 我正在为Android平板电脑开发图形应用程序,但是最近我开始遇到一个奇怪的问题。 The application runs fine on the emulator, but whenever I try to install it on the tablet (a Zenithink ZT-180 tablet running Android 2.2), I get the "Application not installed" error. 该应用程序可以在模拟器上正常运行,但是每当我尝试将其安装在平板电脑(运行Android 2.2的Zenithink ZT-180平板电脑)上时,都会出现“未安装应用程序”错误。

I've tried to narrow the problem down and it seems it may be somehow related to the provided resources. 我试图缩小问题的范围,看来这可能与所提供的资源有关。 I commented out all use of bitmaps in the application, and removed all bitmaps except the icon from the "res/drawable" directory, and compiled the application. 我注释掉了应用程序中对位图的所有使用,并从“ res / drawable”目录中删除了除图标之外的所有位图,并编译了应用程序。 That version installed without errors. 该版本已安装,没有错误。 Next, I placed a single additional bitmap (1024*1000 png, 1.15Mb) in the "res/drawable" directory - I did not load it in the code or anything, I just placed the bitmap in the directory and recompiled the application. 接下来,我在“ res / drawable”目录中放置了一个附加的位图(1024 * 1000 png,1.15Mb)-我没有将其加载到代码中或任何其他内容,我只是将位图放置在了目录中并重新编译了应用程序。 This time, the installation failed with the "Application not installed" error. 这次,安装失败,出现“未安装应用程序”错误。

This seems rather strange to me - how can a single new bitmap in the resources mess up the installation, when it isn't even used by the application? 这对我来说似乎很奇怪-资源中的单个新位图如何在应用程序甚至不使用的情况下就使安装混乱? Any insight would be appreciated! 任何见识将不胜感激!

Update due to mibollma's comment: 由于mibollma的评论而进行了更新:

I installed it by copying the .apk file from the PC onto a USB disk, inserting the USB disk into the tablet, and activating the .apk installer from the USB disk using the tablet's file explorer. 我通过将.apk文件从PC复制到USB磁盘,将USB磁盘插入平板电脑,然后使用平板电脑的文件浏览器从USB磁盘激活.apk安装程序来安装它。 (At a slighly different point in my debugging I tried to copy the .apk first onto the tablet's internal memory storage, but that didn't help at least at that time.) (在调试的一个明显不同的时刻,我尝试将.apk首先复制到平板电脑的内部存储器中,但这至少没有帮助。)

Note that the simple application (the one that doesn't have any images besides the icon) does install fine like this, as does the basic "Hello Android" application. 请注意,像基本的“ Hello Android”应用程序一样,简单的应用程序(除了图标之外没有任何图像的应用程序)确实可以像这样安装。 The trouble apparently happens when I try to add more graphics into the resources... 当我尝试向资源中添加更多图形时,问题显然发生了。

I did not specify installLocation or any special options in the manifest. 我未在清单中指定installLocation或任何特殊选项。

I haven't been able to figure out what caused the problem, but I was able to remove it by basically reinstalling Eclipse and the Android toolkit, and then recreating the application from the existing sources. 我一直无法弄清楚是什么原因引起的,但是我可以通过基本上重新安装Eclipse和Android工具包,然后从现有来源重新创建应用程序的方式,将其删除。

(For future reference: Before I did the reinstall, I did try things like changing the 'debuggable' and 'test only' attributes in the manifest, and checking that the minSDK version matched the specified target, but that did not help. The problem even occurred in the simple "Hello, Android" application - I just placed a bitmap in the resources directory for "Hello, Android" and the resulting .apk did not install correctly. The problem might have been some mixed-up setting either in the toolkit, Eclipse, or in the project configuration, I still don't know.) (供以后参考:在重新安装之前,我做了一些尝试,例如更改清单中的“ debuggable”和“仅测试”属性,并检查minSDK版本是否与指定目标匹配,但这没有帮助。问题甚至发生在简单的“ Hello,Android”应用程序中-我只是在“ Hello,Android”的资源目录中放置了一个位图,结果.apk没有正确安装。问题可能是在工具包,Eclipse或项目配置中,我还是不知道。)

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

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