0

I've been writing my first android app and so far have just been building against the highest android SDK available - 4.1. Up until this point I have only been testing on a physical device running 4.03 and everything seems to work fine.

I would like my min SDK level to be level 8 (2.2) and as far as I know I have not used anything from the APIs higher than this.

However if I build against 4.1 and run on a 2.2 emulator it just shows a white screen and no crash (OpenGL based so something going wrong with this). The same build runs fine on a 4.1 emu and my 4.03 device.

If I build against 2.2 with the exact same code it runs on the 2.2 emu fine.

I don't really know what could be causing this so any tips would be great. Do some classes get replaced in the newer APIs? If they were removed entirely I would assume it just wouldn't build at all against the new version.

Should I be setting my build target equal to my minimum? I am not using anything from the APIs higher than 2.2 currently but I was under the impression I should be building against the newest SDK available. Are there any negative effects of building for the lowest version for instance does it affect the look of the menus/dialogs?

Any help is appreciated, thanks.

Greg
  • 123
  • 6

2 Answers2

0

add this to your AndroidManifest.xml

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="15" />
Ajmal Salim
  • 4,142
  • 2
  • 33
  • 41
0

You should build against the lowest SDK version you intend to be supported by your app (e.g., if you want to support users don't having the newest smart phones or tablets, building against the newest SDK version wouldn't be a good idea).

Generally, newer SDK versions only include additional classes and functions, but I am not 100% sure about any removed classes.

Claas Wilke
  • 1,951
  • 1
  • 18
  • 29
  • Ok thanks very much I will just build against 2.2 as that seems to work fine. – Greg Sep 05 '12 at 19:43
  • Also for anybody else, I found out why building on a higher version failed to run on the lower emulator - I was using a depreciated method (SufaceHolder.setType()). I will probably still build against the minimum version though since I am not using any of the newer features. – Greg Sep 05 '12 at 22:35