Do I need to uses always the last targetSdkVersion? - android

Simple question: In Eclipse "New Android project" command always tries to uses last available sdk. Is it always a good idea?
UPDATE:
I try to explain. Now in Eclipse, "New project" produces a manifest with:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
So, target to the last Android (Jelly Bean, 4.2.x) but it can run also on Froyo (2.2). It's ok for me. What could I do very wrong with this choice?
UPDATE
Is it ok if I set android:minSdkVersion="8" + android:targetSdkVersion="17" and the build target to 2.2 to be sure my app will run on older devices (no NoSuchMethodError exception)?

What could I do very wrong with this choice?
There is nothing wrong with this choice, which is why the build tools default to it.
Setting the targetSdkVersion opts you into specific behaviors that you might not get with an older targetSdkVersion. You can see some of what you get by reading the documentation for Build.VERSION_CODES.

If you want to develop applications for an older version, it is not a good idea. You can always check what the most used version is and make your application against that version. In some cases it is needed to use the latest version because some functionality is not yet implemented in an older version.

You can read more about it here: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
But you should almost always have target as the latest and then change minimum to the oldest you want.

Related

How to downgrade from android 5.0 to android 4.1 on eclipse

My application can only be used on android 5.0 or higher. How would I go about downgrading to version 4.1 in eclipse so older phones can use it.
The answer to your question is in the documentation: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
And this is useful fragment from that page:
<manifest>
<uses-sdk android:minSdkVersion="5" />
...
</manifest>
In case you donĀ“t get a better answer:
You can create a new project for android 4.1, configure the build path and copy src folder.
Not the best method though. Just the one I normally use (the only one I know) and works.

Problems editing target in project properties

I have a library project whose target in project.properties is android-11. I wanted to create an app which uses that library, but compatible with android 4.1.2, so i edited also the library target with android-16.
But when i've done this change, the application gave me some problems and didn't work as before: for example in devices with software menu buttons, the buttons did not appear.
Can you tell me why? Thanks
first of all pls goto the SDK manager and check if you have SDK for Android 16 or above installed. If not please install it, if you have already installed then don't change anything in then project.properties, goto AndroidManifest.xml and make sure that "maxSdkVersion" is equal to above 16, if not it means that the library is depreciated and you cannnot use it for latest version. But generally most of the old libraries would support new SDK builds, so I suggest you to leave it as android-11 as it makes no harm
<uses-sdk
android:minSdkVersion="3"
android:maxSdkVersion="16"/>

Android importing project of different API level

I am already having one small project in android that is build in API-10.
And i am using the latest version of the API-17 and having the same SDK manager.
Now when i import this project it shows error like Unable to resolve target 'android-10' and some more lines.
So, when i Googled about this problem i found that i think i need to download API-10 and the SDK.
So i wanted to know why its needed?
Because my existing code is built in API-10 then i think it should be compatible with API-17.
I am new to Android i just understood some concepts like Activity, Services and many more but when i came around this issue i really shocked?
I just wanted to understand why its needed while i am already having SDK for API-17?
try by adding targetSdkVersion to the manifest file
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
and clean your project, that might also help
What that means is you need to start your Android SDK Manager and download and install API Level 10. Why do you need API Level 10 ? Well, the project you are importing needs that API level.

How to run Higher version application in lower version?

I have developed one application which is running properly in android 4.0(icecream Sandwhich) but not working in 2.3.3(ginger Bread).
It is showing the error like process example.app_name is stopped unexpectedly in 2.3.3 but its
working fine in 4.0.3.
Is any one know that app has to be run on version 2.3.3 ?
Thanks in Advance...
try this it may work
add this line to your code in AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
add this as child of <manifest> tag and change values according to your needs
First of all, you need Support Library
The Support Package includes static "support libraries" that you can add to your Android application in order to use APIs that are either not available for older platform versions or that offer "utility" APIs that aren't a part of the framework APIs. The goal is to simplify your development by offering more APIs that you can bundle with your application so you can worry less about platform versions.
Go thrue the step Setting Up a Project to Use a Library
And also set the min. SDK version in Manifest, otherwise you won't be able to install your application to device

Android App compiled on AOSP can't be installed in lower sdk-version emulator

I downloaded the newest source code of Android form git,
and I managed to compile the source code and made a SDK and a emulator with the verison AOSP.
Then I tried to modified the source code of LatinIME the input-method and managed to compile and run on the emulator compiled along with the code of version AOSP.
Then I want to install the apk to my phone whose sdk-version is 2.2, and the error appeared to say my sdk-version is too low.
I'm sure I've add the <uses-sdk android:minSdkVersion="8" /> in the manifest node in AndroidManifest.xml , but it still needs the AOSP version to install.
Is that means I will have to repo the 2.2 version source code to compile the apk so it can fit my phone?
OK, I'm answering my own question again, I can't understand why my questions always rarely answered.
However I searched the whole Internet and can find a answer, but in luck I saw this:
version_defaults.mk of API Key 7
I simply replaced the android/build/core/version_defaults.mk in my downloaded code tree and re-compiled the module, and it worked!
Thought I don't know if it will work all modules in the source code, but however my IME works good.
Why have you added in the manifest the min sdk version? I don't think you have added features compatible only for froyo or newer.
The original manifest http://www.google.com/codesearch/p?hl=it#cZwlSNS7aEw/packages/inputmethods/LatinIME/java/AndroidManifest.xml&q=latinime&d=2
deos not have a min sdk version. Try to remove it.

Categories

Resources