Problems with layout using <uses-sdk android:minSdkVersion - Android - android

I was publishing my first APP but i have a problem, I have tested my app with a lot of AVD then i tested with my phone(Galaxy S) and with my girlfriend phone (Galaxy 5) before publishing, when i tried to publish i received a msg to specify an API level requirement. then i put this code
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="7"
/>
then i tested in the AVD and i had no problem, but when i publish and tested in my Galaxy S, i encountered a crazy layout of my app, i do no why, so i go back to the Eclipse and tested direct to my galaxy S and get the same error, so i take this part of the code out and then tried again in my galaxy S and the layout is all OK, so i`m probably doing some thing wrong.
Many Thanks Sorry my poor English i`m from Brazil.

I think it is do with your layout defintion. What values have you used for layout_width and layout_height? (for layout and widgets)? You should use "wrap_content" of "fill_parent" and if you are forced to give exacts, give values in dip (100dip) rather than px or pix. Read this doco for more details http://developer.android.com/guide/practices/screens_support.html

It may be because your 2 phones have different android versions. Do this, create 2 emulators with exact same android version, screen size and density as your 2 phones and test and debug there.

Leave the minSDK declaration and get rid of the target SDK. You are using two separate declarations.
<uses-sdk android:minSdkVersion="4"/>
This is the only one you need.

I have seen this too. My app runs on everything from api level 4 and up. When I add
<uses-sdk android:minSdkVersion="4"/>
to my manifest and run on my G2 I get a crazy layout. Thanks for this heads-up. I will report later on the changes I had to make.
m.

Related

Scroll Div issue in cordova app

Hi i'm developing a cordova application for android and sometimes I have a scroll issue on a div with a table. The scroll has a strange logarithm movement. Someone knows how to solve it?
Can you be more specific on how the "logarithm moviment" should be? I faced some problems with scrolls and tables in two different situations and I hope the following information can help you.
1 - Table out of devices width: Sometimes, when you build a table, some incompatible CSS should make it wider than main div width and generate a strange horizontal scroll. Try to review your involved CSS;
2 - Android Manifest: I noted that some devices (especially those running older versions of Android) may have some performance issues caused by a Manifest Configuration. Try to change "hardwareAccelerated" to FALSE
<application android:hardwareAccelerated="false">
Hope it helps! Best regards!
This issue might be caused by the Android emulator. Check out if that weird scrolling is also present on a real device. It should not.
In my case I used the emulator for the Nexus 5x and got that strange "logarithmic" scrolling. When running my the very same app on a real Nexus 5x everything is fine.

View not painted in a particular case

Dear Stack Overflow Users,
I am exploiting the Vintage Thermometer Template of this example (source code downloadable)
http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/
The only part of code I modified is the parametrization of the background image and the scale. My trial app works fine, both in the emulators (A phone 4.0' Android 4.3) and a Tablet (7.0' Android 4.4.2), and my phones, a Galaxy S Plus, and a Galaxy S III.
Since the code seemed to work I moved the view to another project where I'm using the Thermometer as Speedometer. Here again, everything is fine, both in the emulators and my Galaxy S Plus..., but not in the Galaxy S III!
What does work and what doesn't: everything works but the method drawHand() apparently. The hand is not painted for some reason. And just in this new project just with the Galaxy S III.
Now, everything in the layout and the code seems OK. I can't find cross compatibility issues anywhere. What I am asking you is maybe a more general question: something like this can actually happen and why? I searched for days for some similar issue without finding anything.
The view is inflated in the same way:
<com.example.speedometer.Tachimetro
android:id="#+id/tachimetro2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.5" />
inside a linear layout.
The manifest has nothing except the call for the main activity.
Galaxy S III is the only phone where something is not painted.
That's weird. Any idea what could be my next step?
Sorry for late response, but please try disabling hardware acceleration. One way to do that is to add the following to your manifest file:
<application android:hardwareAccelerated="false" ...>
Related solution to wthomas, instead of manually disabling hardware acceleration, in the mayou can target API 13 or less:
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="13" />
it was after API 14 (4.0 Ice Cream Sandwich) that hardware acceleration became "automatic."

Android Tablet Zoom option missing

I've developed an android application whose GUI is designed for small screens. When run on a tablet it looks rubbish because I've assumed 320dp width to make my life easier - I don't have the resources to test on tablets.
People using android 3.2 were able to zoom into the app so it looks like it's running on a big phone. But after my last update that option is not available, and I don't understand why.
The change is related to the Manifest file. Here's what my orignal app had (there's nothing to do with screens in my Manifest):
<uses-sdk android:minSdkVersion="7" />
After updating my development environment, I got a warning saying I should specify a target sdk, so I did this:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="10" />
Using a painfully slow Android 3.2 emulator I have confirmed that this has caused the problem. I thought any target SDK below 11 wouldn't affect the zooming option?
Using the following also removed the zoom option:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="9" />
But this didn't:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8" />
So setting my target SDK to 8 is a workaround, but it's also wrong because I use version 2.3.3 for testing.
Am I missing something here? Is there a better solution?
Thanks.
Try setting targetSdkVersion to 9 (or 10) and adding <supports-screens android:xlargeScreens="false" /> to your AndroidManifest.xml (docs for supports-screens). This tells the system that your application does not explicitly support xlarge screens and that it should offer the compatibility zoom/scale option for users that use the app on xlarge devices. Note that this will not cause the app to be hidden from xlarge devices on the Play Store (supports-screens only causes Play Store to filter apps from smaller screens if they are designed to run on larger screens, not the other way around).
The reason I think this is happening once you set targetSdkVersion to 9+ is because supports-screens xlargeScreens was added in API Level 9 and (I believe) defaults to true (for API Level 9+ at least). Once xlargeScreens is true the system will disable the compatibility zoom/scale mode.
Supporting docs (where it does say this but is fairly convoluted):
http://developer.android.com/guide/practices/screen-compat-mode.html
http://android-developers.blogspot.com/2011/07/new-mode-for-apps-on-large-screens.html
http://developer.android.com/guide/topics/manifest/supports-screens-element.html

Android app wont scale to fit Tablet screen

Hi im having problems getting an app i have written for the motorola xoom to fill the screen. When i run the app it runs it in the middle of the screen as if it was on a phone or something. When creating the main.xml at the top it is showing the screen as a 10.1in WXGA screen and the system at the right hand side is set to Android 3.1
Any idea what im doing wrong?
Screen sizes beyond phone screens was added in Donut (API 4). Thus to say that you know about different screen sizes, you need to set at least API 4 as the target SDK version in your manifest:
<manifest ...>
<uses-sdk android:targetSdkVersion="4" />
  </manifest>
This allows the system to use the modern defaults for the supported screens that you can specify with this:
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
The use of android:targetSdkVersion is very important, since it allows the platform to disable a variety of compatibility behavior for your app to allow it to run better on more recent versions of the platform. Some of the things it impacts can be found here:
http://developer.android.com/reference/android/os/Build.VERSION_CODES.html
I had the same problem with porting to Galaxy Tab. Make sure you specify the correct API Level. I used an old one and had the same behaviour.
Try adding this to your AndroidManifest.xml: <uses-sdk android:minSdkVersion="4" />

Generating Balls for Android Game

I am making a game in Android where i am generating random number for different colored balls. Currently i am generating buttons dynamically and settings the background resource.
I am using some high resolution icons as images. However when they render on screen, all of them gets slightly pixelated and don't look good on screen. I tried it with different sizes of icons but it was of no use.
Can anyone suggest where i can be going wrong and what can be the best way to take care of these things. I am new to game programming so any help would be appreciated.
I would guess that your application is not running at your phone's maximum resolution. You need to specify the target version of Android in your manifest file, otherwise the app defaults to an early version and only runs at low-res.
If your phone supports Android 2.2 (Froyo) then try adding this line to your AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="8" />
Be sure to put it in the manifest section, not the application section. If you see a line for "android:versionName" then put it immediately after that line.
If your phone doesn't support Android 2.2 then change the minSdkVersion number to 7. If it's an older version then go down to 6 or 5. You'll need to make sure you have the correct SDK files installed on your development machine. (ie: you won't be able to compile an Android 2.2 app if you only have the 2.1 SDK installed.)

Categories

Resources