-1

I have developed a Android application with targetSdkVersion="15" . When I run this application on Android 4.0.3 it's working fine. but When i was try this on Android 2.3.3 it shows the error. so, now I would like to know, how can we find the versioning problem automatically and how can we omit the versioning problems while we develop. kindly some one guide me in this. thanks in advance.

This one is stack trace in my logcat.

10-04 08:36:00.731: W/dalvikvm(413): threadid=1: thread exiting with uncaught exception    (group=0x40015560)
10-04 08:36:00.742: E/AndroidRuntime(413): FATAL EXCEPTION: main
10-04 08:36:00.742: E/AndroidRuntime(413): java.lang.NoClassDefFoundError:     com.net.elderlyhealth.MainActivityMainpage$PagerAdapter
10-04 08:36:00.742: E/AndroidRuntime(413):  at  com.net.elderlyhealth.MainActivityMainpage.onCreate(MainActivityMainpage.java:62)
10-04 08:36:00.742: E/AndroidRuntime(413):  at  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.os.Looper.loop(Looper.java:123)
10-04 08:36:00.742: E/AndroidRuntime(413):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-04 08:36:00.742: E/AndroidRuntime(413):  at java.lang.reflect.Method.invokeNative(Native Method)
10-04 08:36:00.742: E/AndroidRuntime(413):  at java.lang.reflect.Method.invoke(Method.java:507)
10-04 08:36:00.742: E/AndroidRuntime(413):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-04 08:36:00.742: E/AndroidRuntime(413):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-04 08:36:00.742: E/AndroidRuntime(413):  at dalvik.system.NativeStart.main(Native Method)
Rathakrishnan Ramasamy
  • 1,612
  • 2
  • 25
  • 46

3 Answers3

2

Could you provide the stacktrace of the error? So that at least we could get some idea on how we could help you?

With regards to omitting the version problem, might as well try adding the line

android:minSdkVersion="8"

in your manifest file right before

targetSdkVersion="15"
gorbos
  • 311
  • 1
  • 7
1

Well, the answer is simple.

The android SDK makes the targeted API available to your project. If you use an API which is not available in lower versions then you will get the error.

Workaround

  1. check the availability of an API on the docs before using it

  2. use reflection and cater for cases when the API is not available. The behaviour of your app will not be consistent across all the devices.

  3. You should actually target your project to the minimum API.

Nar Gar
  • 2,591
  • 2
  • 25
  • 28
0

The android LINT checks go some way towards this, but honestly beyond that the best way is to run the app on a device with your minimum SDK version on a regular basis.

themightyjon
  • 1,241
  • 11
  • 12
  • yes you are correct.. it's gives me clear idea on this. thanks. – Rathakrishnan Ramasamy Oct 04 '12 at 01:40
  • Also if you conditionally load code for an API level above your minimum (like this: http://android-developers.blogspot.co.uk/2010/07/how-to-have-your-cupcake-and-eat-it-too.html) it's worth looking at using the @TargetApi annotation to identify it. – themightyjon Oct 04 '12 at 11:28