Today I upgraded to SDK version 3.0 from 2.3.3. I have one question that has always puzzled me.
My code is unchanged from when I built it with build target API level 7, so there are no API level methods called. I've now changed the Properties/build target to API level 11 but set the minSdkVersion to level 7 in the manifest.
When I set up a run configuration under Eclipse, the only AVDs available to me are level 11. Should not the level 7 AVDs (which do exist on my machine) be available as targets?
If not, what use is setting the minSdkVersion to 7, as I can't test it on a level 7 emulator?
In the Debug configuration panel for your app, you have to go to the Target Tab and change the Deployment Target Selection Mode to 'Manual' and once you click on Debug button, you'll get a "Android Device Chooser" dialog where you can specify which AVD to startup.
Related
I am new to android development and Android Studio. I also have a physical device which runs android version 5.0.1. When I try to debug an app from Android Studio on my device I don't get the behavior as in the emulator.
My project's target API level (when I create it) is always 23 (Android 6.0 Marshmallow). Although the minimum API level is 17 (Android 4.2 Jelly Bean) I want to know how to set the target API level on project creation. Is this possible with the current version of Android Studio (1.4.1)?
There is no way to choose the target API level using the New Project wizard in Android Studio currently (1.4.1). It should always be the latest version available anyway.
From http://developer.android.com/intl/es/training/basics/supporting-devices/platforms.html#sdk-versions:
To allow your app to take advantage of these changes and ensure that
your app fits the style of each user's device, you should set the
targetSdkVersion value to match the latest Android version available.
To modify it after project creation just edit the targetSdkVersion value in your build.gradle file.
I have set the minSdkVersion to 15 and build target to 19 in project properties. I am using Eclipse. I have created 2 AVDs. On with sdk 15 and the other with 19. When I run the project, Eclipse shows me only the AVD which is build with sdk 19. Should it also not show the one with sdk 15 since i have mentioned minSdkVersion as 15? Does this mean my app will not be shown to devices which are running sdk 15 in the market place?
minSDKVersion means the minimum supported version so the app will show up for devices running sdk 15. For me, in Eclipse, all supported emulators show up in android device chooser.
More info : http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
When you want to create project through wizard, it asks you enter Project Build Target. Assume that
I want my application to support Android 2.1 and above,
My test devices are a hand phone with Android 2.3.3 and a tablet 7" with Android 3.2.
Is it mandatory to choose "Android 2.1 (API level 7)" in Project build target?
May I set Project Build Target to "Android 4.0.3 (API level 15)"
Manifest:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
Yes, the project build target SDK version may be higher (but not lower obviously) than the minimum SDK version specified in the Manifest. Just make sure to avoid calling APIs that came in with higher SDK versions than the minimum you specified.
Yes you can. The targetSdkVersion helps the device with higher API level to use the newest (optimized) version of the implementation rather than the default implementation of the minSDKVersion and prevent enabling the compatibility behaviors. Make sure you test on device running this version though.
Ref: targetSdkVersion
I want to add a new feature, move2SDcard available only on API8 (Android2.2) but making minSdkversion="4". So, I change the Android jar file loaded in eclipse by (project prop -> Android ) and select Android 2.2 Project compiles and runs.
Is this a good way to add new apis specific to new versions.
for minSdkversion you need to specify the minimal api level with which you app runs with no problems, in you case api level 8. If you say min sdk 4 that means that your app will be able to be installed on phone with api level 5 and in app with api level 5 I think your app would NOT be able to work correctly.
with Android 2.2 it goes minSdkversion="8" (API level 8) FROYO
here are some platform highlights http://developer.android.com/sdk/android-2.2-highlights.html
take a look to the statistics of the market and you will understand that most of the apps are above API 8 http://developer.android.com/resources/dashboard/platform-versions.html
While creating an android project if i say that the Build Target of my Android porject is 2.2 (API Level is picked as 8) and in the text box for Min SDK version. If i put some value apart from the API level (smaller or greater than 8) of the build target then what happens?
Does the build happen according to the build target specified, but the application developed is compatible with the smaller android versions (if i specify API level < 8 ). Or the application developed is only compatible for the higher android version (if i specify API level > 8 ).
Can anyone please explain?
There is a similiar question already posted with an excellent answer:
Read the post by Steve H.
Android Min SDK Version vs. Target SDK Version
Say you set the manifest API level to 4, then the app will work on any api 4 device provided. BUT the project will be built to API level 8 so if you have any post-level 4 api methods in your code then the app will crash.
You can only put min SDK version less than your target version,it tell that your application can support to that min SDK version,but you should confirm that your application should run under min SDK version supported devices since the Build target versions may use new APIs which are available for that specific version and those APIs may not available in min SDK versions
ok.. if you have developed an application using particular sdk for instance Android 2.2 and your minSDKversion is < 8 then application is falsely declaring to android system that It can be installed in Android device having sdk version less than Android 2.2. In that case if application happens to install on Android 2.1 and if you re using API that are exculsiviely avaialbe in Android 2.2 platform and not on Android 2.1 then your application will crash on the device. if your minsdkversion > 8 then application won't get installed on the device having Android sdk 2.2 or lower version