Android dalvik problem - android

Please i have different platforms installed. I just wanted to know what am supposed to do. If i develop with 3.0 platform, would those with a 2.2 be able to use my app??..
The second question which is the main question is I always get this error when i create android projects..
[2011-05-16 16:32:21 - Hello World] Dx no classfiles specified
[2011-05-16 16:32:21 - Hello World] Conversion to Dalvik format failed with error 1
What do I do to it?

There are several reports out there for that error (e.g., this one. All the solutions point simply to reload the project (select it in the tree at your left, and press F5).
Regarding the first question, unless you want to support Honeycomb-only features, then set up the api level to 8 (Froyo).
Eclair, Froyo and Gingerbread are android versions 2.1, 2.2 and 2.3 respectively (also referred in the documentation as API levels 7, 8 and 9). See the table here. If you want to support just mobile phones, set your target to 2.1 or even lower. That way you will be able to target most of the phones in the market. Your app will also run in Honeycomb (3.x) devices.
Honeycomb has new features to support larger screen devices, so if that is your main target, you might consider taking advantage of those features and drop cell phone support. All will depend on what is your objective.

you should have a look at the minSdk and targetSdk features of a manifest file :
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
This will help you target a android sdk version and precise what is the minimum sdk level that can run your app.
Regards,
Steff

Developing for Honeycomb or non-tablet version of Android, is different in various things. Your 2.2 application should run correctly on a tablet, but if you want to optimize the graphical interface and use all the notification and other things included only in Honeycomb, then you must use the appropriate API. Until Ice Cream Sandwich is released, we have to develope two different application for the best result.
Regarding the error you get with android projects (I suppose under eclipse?) you'll find some detail at this link, but if you follow all the instruction provided by google in the developers page, you'll be able to write and run your Hello World application.

Related

why don't I choose all versions for android app?

When I created my application, I chose 1.0 for the minimum SDK and 4.3 for the target SDK, so my application works on all phones.
But why would we choose (for example) a minimum SDK of 2.2?
Is it about performance, or something like that?
First of all i'd like to clear,
android:minSdkVersion="integer"
Despite its name, this element is used to specify the API Level, not the version number of the SDK (software development kit) or Android platform. The API Level is always a single integer. You cannot derive the API Level from its associated Android version number (for example, it is not the same as the major version or the sum of the major and minor versions).
find more detail
we choose minimum and maximum version for our app because , some of the feature which are not supported in lower/higher versions of android are used in app . The Android system will prevent the user from installing the application if the system's API Level is lower/higher than the value specified in this attribute.Hence preventing unwanted force close.
Most of the features of higher versions of android will not work in api level 1 .thwn why will you put level 1 as minimum sdk.
Android is a system that is everytime changing, and that implements new features in each new version.
When you develop an app, you will have to deal with :
Compliance for the user
Nice features for your application
For example, animations of clickable elements are not well implemented in Android 2.3. So when you will have to develop an application, you will have to choose :
Compliance with a maximum users including 2.3 compliance
Develop a lot of nice animations, including on clickable elements
It's why sometimes you decide to develop an applications, you may decide to not include some versions of the SDK.
And for having a clear view on how much users you would loose, you may want to go to :
Dashboards
99,9% of phones use SDK 2.2 and later and all cool features that you can use are avaliable on later SDK versions than 1.1. That is the main reason, but you can use earlier version of SDK for minimum but in has no efect because you are covering all devices with 2.2 SDK.

What are API levels in Android?

I am starting to learn android development. I downloaded adt-bundle-windows-x86 from the android site. Now when I open the SDK manager that comes with the bundle it enlists a number of API levels. My phone has ICS. But when I saw wiki for the same it seems we can have more than one API levels for a single code name.
Which one is to be used? I want backward compatibility and also not miss on the new features that might have been introduced in ICS. what do these API levels mean and how do I decide which one to use?
Here is a link to the list of Platform Version - API Level - VERSION_CODE - Notes
This link shows data about the relative number of devices running a given version of the Android platform.
I recommend:
minimum sdk version = Android 2.3.3 - Gingerbread - Api level 10
target sdk version = Android 4.3 - JellyBean - Api level 18
NOTE the target sdk version most of the time should be the latest release which at current is JellyBean
Here you can find a list of api levels, code names and usage statistics.-
http://developer.android.com/about/dashboards/index.html
You should try making your application compatible with as much devices as possible, so I'd recommend to make sure that works fine at least on Android 2.3.3 - Gingearbread - Api level 10
Regarding new features, sadly, keeping in mind old devices sometimes means forgetting about some new cool features or apis which are included to make our lives much easier.
I think this can help you a lotclick
You should set api level as minimum as possible like 2.3.3 gingerbread. 35% of android devices still runs on Gingerbread. But as per your question it seems like you wanted to start development from 4.0.4 ICS. So set your min SDK 14. And as far as new graphical or library changes google provides support library for use.
One suggestion set max api level as high as possible. I mean 4.3 for now. hope this would help

Using the Android support library to support older

I'm developing an Android app and have been looking around a bit on how to support older versions(I've been developing for 4.0 while 10% of the phones are on 2.2 and 50% on 2.3). I've found the support library and wanted to see if I understood things correctly.
I get the support library for version 2.2.
I switch from using the stuff from the normal .jar to the one from
the support library. Seems to be a bit of code changes and new imports.
My app is now working on Android 2.2
I've found the support library and wanted to see if I understood things correctly
Steps 1 and 2 are fine. Depending on your starting point, you may have intervening steps before Step 3, such as adjusting android:minSdkVersion to support API Level 8 (Android 2.2). And, depending on what else you may want to use (e.g., ActionBarSherlock for a consistent action bar pattern), you may have more steps to add.

Which is the highest version of Android on which a Android 2.0 app will work?

I am using a textbook which uses android V2.0. Can you tell me which version of android can run apps for version 2.0 without any problems ?
If you are going for just running the app, then any device with API level 5 (Android 2.0) and up (that includes Jelly Bean and any future versions) will be able to run your app without any problems. The developer docs have an API level guide here.
However, you should familiarize yourself with subsequent versions of Android so that you can make an informed decision on what version you should use, and what features you will be unable to use.
For example, you can see on the Supporting Multiple Screen Sizes page that Android 3.2 (API level 13) introduced new features for supporting multiple screen sizes. If you use API level 5, your application may not scale correctly on some devices (namely tablets).
Though it is tempting to try to support as many devices as possible, there is a definite trade off involved with using a lower API level. For some apps, it doesn't really matter if it scales correctly, but it is something that you need to take into consideration when choosing a target or minimum API level.

Ensure Android project doesn't call APIs with newer-than-intended API level

When developing an Android app, let's say I want it to be compatible with 1.6 (API Level 4) devices, but still enabling 2.2 (API Level 8) features such as adding android:installLocation to enable moving app to SD card. Therefore I set Eclipse to compile against 2.2 SDK instead of 1.6 SDK.
Adding unknown attribute like android:installLocation doesn't crash the app when running in 1.6 device, but in case when coding I call some API that is unavailable in 1.6, such as android.util.Pair or Base64, the app will crash when running in 1.6.
Is it possible (e.g. via an Eclipse plugin) in build-time (not in run-time!) to check whether the project is still compatible with 1.6, in other words, check whether there is any API calls to any of the methods/classes requiring more than 1.6 (API Level 4)?
The best way to check if your app uses a non-existing API on older handsets is to change the target to the old version (starting from the minimal one you support) and seeing if you have any compilation errors... This will point you to non-compatible API calls.
At least that's the way I do it.
This is a tough problem to handle gracefully in code. I asked a very similar question here.
It seems to me that you may be asking the wrong question. Checking for calls to new API features is reasonable, but if you want to make your app work well over multiple versions, you will have to have code that makes calls to old and new API levels as appropriate. There are many ways to do this and it's considered a best practice.
In that case, you may want to downgrade your target version and check that all the errors that come up in Eclipse are handled well in your code (and of course try it in the right emulator versions).
I know this question is ancient, but there is a "holy grail" solution to this issue (at least from your users' point of view):
You can publish two versions of your app, one requiring API level 8 and another requiring API level 4. Then, use versionCode 100, 101, 102, 103, ... for your level 4 version and versionCode 200, 201, 202, 203, ... for your level 8 version.
That way, if a user has API level 8 available, they get offered only the level 8 version of your app as it has the higher versionCode. And users that only have API level 4 through 7 available, get offered only the other version as the other one is incompatible.
It's a little bit more of a pain to maintain, but it has the (potentially huge) advantage that you can customize the reduced-features version to still provide a complete experience (no grayed-out buttons, etc.), and you can even keep the APK size smaller for that version as you don't even need to ship the code or related resources for the unavailable features.
You can find more details in Android's Multiple APK Support documentation.

Categories

Resources