我们遇到与清单文件和属性“android:minSdkVersion”相关的问题。
问题是:如果我们的平台是 2.0 并且我们使用属性“android:minSdkVersion=3”(3 = sdk 1.5),则图形会损坏(具体来说,应用程序的分辨率会降低到原始大小的 2/3) ,这是,当分辨率应该是480x720时,它变成了320x480)。这种情况发生在 Android 模拟器和 Droid/Milestone 设备(平台 2.0)上。当我们将属性切换为“android:minSdkVersion=4”(4 = sdk 1.6)时,问题就解决了,但是当我们想将该版本放在平台1.5上时,Android不允许我们安装它。
它将帮助我们了解 2.0 sdk 中有关图形的任何冲突,或清单中有关“android:minSdkVersion”的任何已知问题。
谢谢!
we have a problem related to the manifest file and the property "android:minSdkVersion".
The issue is: If our platform is 2.0 and we use the property "android:minSdkVersion=3" (3 = sdk 1.5) the graphics get corrupted (In details, the application's resolution get reduced to a 2/3 part of the original size, this is, when the resolution should be 480x720, it becomes in a 320x480). This is happening on the Android emulator, and on the devices Droid/Milestone (Which are platforms 2.0). When we switch the property to "android:minSdkVersion=4" (4 = sdk 1.6) the problem gets solved, but when we want to put that version on platform 1.5, Android doesn't allow us to install it.
It would help us to know any conflict regarding graphics within the 2.0 sdk, or any known problem around the "android:minSdkVersion" in the manifest.
Thanks!
发布评论
评论(3)
如果您指定
targetSdkVersion
以及minSdkVersion
,您的应用程序将开始在所有平台上正常工作。因此,您的清单中应有一个如下所示的条目:
Android 开发者文档中的Android API 级别页面。
If you specify
targetSdkVersion
as well asminSdkVersion
your application will start to work correctly on all platforms.So have an entry in your manifest like this:
This is covered in the Android API Levels page in the Android Developer documentation.
我假设您使用目录为不同的屏幕密度指定不同的资源像 res/drawable-mdpi 、 res/drawable-hdpi 等?
Android 1.6(API 级别 4)是第一个支持多种屏幕密度的 SDK 版本,因此它知道这些目录名称的重要性,因此可以从您的
res
文件夹中成功选择正确的可绘制对象。它运行的特定设备。但是,如果您在 Android 1.5 设备(API 级别 3)上运行以这种方式开发的应用程序,那么框架不知道它应该只使用中等 DPI 资源(因为除了 Android 1.5 设备之外,没有发布任何 Android 1.5 设备)中等 DPI 屏幕(AFAIK))。因此,在这种情况下,框架最终可能会从 APK 中的所有可用资源中看似随机地进行选择,无论它们是用于高密度屏幕还是中密度屏幕,还是其他什么。
但是,我还没有看到与您相反的情况,即 2.0 设备似乎会选择不同的屏幕密度,或者假设不同的屏幕密度。
我会确保您的
res
目录布局正确,并且您正在使用 密度无关测量在每个布局中酌情进行。但如果您想在单个 APK 中支持多种屏幕分辨率和密度并支持 Android 1.5 设备,那么我认为这是不可能的。
I assume you're specifying different assets for different screen densities using directories like
res/drawable-mdpi
,res/drawable-hdpi
and so on?Android 1.6 (API level 4) was the first version of the SDK to support multiple screen densities, so it knows the significance of these directory names and so can successfully select the correct drawable from your
res
folders for the particular device it's running on.However, if you run an application developed in this way on an Android 1.5 device (API level 3), then the framework does not know that it should only use the medium DPI resources (as there are no Android 1.5 devices released with anything other than medium DPI screens (AFAIK)). So in this case, the framework can end up choosing seemingly randomly from all the available resource in your APK, whether they're intended for high density screens or medium density screens, or whatever.
However, I haven't seen the reverse happening that you are, i.e. a 2.0 device appears to select drawables for, or assumes, a different screen density.
I would make sure your
res
directory layout is correct, and that you're using density-independent measurements in each of your layouts as appropriate.But if you want to support multiple screen resolutions and densities and support Android 1.5 devices in a single APK, then I don't believe it's possible.
将此标签添加到 AndroidManifest.xml 中以支持多种屏幕密度。
Add this tag in your AndroidManifest.xml to support multiple screen densities.