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!
If you specify targetSdkVersion as well as minSdkVersion your application will start to work correctly on all platforms.
So have an entry in your manifest like this:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
This is covered in the Android API Levels page in the Android Developer documentation.
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.
Add this tag in your AndroidManifest.xml to support multiple screen densities.
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="false" />
Related
I have a tablet with mdpi screen (xlarge). Is it possible to emulate some other screen configurations on it? I have layouts for middle-size screens and I want to see how they will look like without using emulator (it causes a lot of pain for my PC).
For example, I've seen something like that on iPad (when its running iPhone apps)
can try this link http://developer.android.com/guide/practices/screen-compat-mode.html
add in the manifest file
There are two versions of screen compatibility mode with slightly different behaviors:
Version 1 (Android 1.6 - 3.1)
Version 2 (Android 3.2 and greater)
Disabling Screen Compatibility Mode
If you've developed your application primarily for versions of Android lower than 3.0, but your application does resize properly for larger screens such as tablets, you should disable screen compatibility mode in order to maintain the best user experience. Otherwise, users may enable screen compatibility mode and experience your application in a less-than-ideal format.
By default, screen compatibility mode for devices running Android 3.2 and higher is offered to users as an optional feature when one of the following is true:
Your application has set both android:minSdkVersion and android:targetSdkVersion to "10" or lower and does not explicitly declare support for large screens using the element.
Your application has set either android:minSdkVersion or android:targetSdkVersion to "11" or higher and explicitly declares that it does not support large screens, using the element.
try removing
<uses-sdk android:minSdkVersion="10">
from your AndroidManifest File.
by this, if your project uses like GingerBread then it will show in 480x800
I've set up NetBeans to run my app on my Asus Transformet tablet, however, it runs using the size of a phone screen, and then gets stretched over the screen. How do I fix it so it uses the tablets resolution?
You can have custom layouts depending on the size of the screen. For example if you have a xlarge screen you can create the layout folder 'layout-xlarge' and 'layout-xlarge-land'. In these folders you can put the layouts (with the same name and variable names) but change the layout as needed.
I'd suggest reading this as well:
http://developer.android.com/guide/practices/screens_support.html
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="11" />
Use targetSDK = 11 to target for the tablets. Your UI will automatically scale to the tablet size. Use minSdKVersion = 4, if your app should run on phones with Android 1.6 or more
For more API levels, you can check this out, http://developer.android.com/guide/appendix/api-levels.html
I have a backward compatible app which is using screen specific layout (only for HVGA). Structure of my layout is as follows:
res/layout
res/layout-480x320 (for HVGA)
layout-480x320 contains few sepcific XMLs.
Manifest is as follows:
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="11"
android:maxSdkVersion="15"/>
When I am running this app in Galaxy Nexus (720x1280), the kayout is taken from 480x320 folder. I have built it on 2.1 target and 4.0 target. Both are resulting same result.
Can anyone please help.
This is a stange change made to ICS 4.0 (or may be 3.2).
Pre ICS:
If you specify "layout-480x320" it finds and exact match and take from this folder if you device is HVGA, else it will fallback to "layout" folder.
ICS:
If you specify "layout-480x320" Android think this layout is good for any resolution which is "same OR ABOVE" 480x320, hence it does not fall back to "layout" folder. So you have to provide another folder with higher resolution.
So, now it not EXACT match but a "Range" based matching.
I dont know if this is a feature or bug. But going through the documentation it seems, it is a feature. :)
I have scoured the internet for this answer, and I feel like I keep getting close to it but then it turns out to not be quite what I want. If someone posts a quick link that specifies exactly what I need I will be quite disappointed in myself...
I am making an Android app whose minimum api is 4 and android version is 1.6. It works on tablets, but it is not optimized quite yet, so when I publish it I do not want tablets to be able to find it at all. I have read the support screens android pages about adding this code to my manifest:
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xLargeScreens="false"
/>
That particular code ( android:xLargeScreens="false") is not supported with android 1.6, so I cannot add that to my manifest. The definition of each screen is pretty vague as well... for instance, the large screen size is defined as "a screen that is significantly larger than a "normal" handset screen". Does that mean the largeScreens are tablets as well? Do I need to set that to false??
So since that is not an option, and knowing my specs... how do I filter my app in the android market so that it does not show up for tablets?
AFAIK, it is impossible to close that xlargescreen possibility - you have set the problem correctly.
Don't be afraid of all tablets - there are very many cheaper ones that have screen smaller than that of modern phones.
Don't be afraid of greater tablets, too. Their owners are accustomed that SW for elder than APK 9 versions are not optimized for their devices. It couldn't be.
Edit:
cite from the android developer guide:
Caution: If you use the <supports-screens> element for the reverse
scenario (when your application is not compatible with larger screens)
and set the larger screen size attributes to "false", then external
services such as Android Market do not apply filtering. Your
application will still be available to larger screens, but when it
runs, it will not resize to fit the screen. Instead, the system will
emulate a handset screen size (about 320dp x 480dp; see Screen
Compatibility Mode for more information). If you want to prevent your
application from being downloaded on larger screens, use
<compatible-screens>, as discussed in the previous section about
Declaring an App is Only for Handsets.
I think all you have to do is remove the screen support for big screens.
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
So that the market would know your app is only compatible on certain screens.
I'm getting ready to release my first application the marketplace. It's being written for devices running Android 1.5 and above, however there aren't any specific folders for the three different screen densities (I think those came around in 1.6). Should I make these folders myself? Where should I put image resources for the different densities and what should I put in my Manifest??
You will actually want to set your application up to target Android 1.6 in order to get the folders with different drawable levels, but then set the minSdkVersion="3" in the XML and rename the drawable-mdpi folder to just drawable. It will give you a warning about version mismatch but this is how supporting 1.5 but getting the nice features of 1.6 is done in Replica Island for example, which was made by a Google developer advocate. One thing to keep in mind is that by targeting 1.6 instead of 1.5, you can add targetSdkVersion="4", so that it will not force all screens to emulate 320 width, but then you will need to be far more aware of how the app will actually look and test it more thoroughly.
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
For more information, read http://developer.android.com/guide/practices/screens_support.html, especially about halfway through where it mentions the XML settings.
There are a number of bugs in the system that need to be worked around as well.
The best strategy I've found to use is:
res
drawable
drawable-hdpi-v4
drawable-ldpi-v4
layout
layout-hdpi-v4
layout-ldpi-v4