v14 Layout File is not updating - android

I have developed an android app with minSdk = 10 now I want to add a Switch in one of the Activity (has the layout file with name content_main.xml).
As the Switch need the minSdk to be 14, I have updated the same in AndroidManifest and
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
But when I added the Switch on the xml, it still giving an error as the
View requires API level 14 (current min is 10)
Moreover Android Studio automatically created a duplicate layout file, one for the current sdk version and another for API level 14 and they are not being updated automatically, which creates a conflict in the UI.
Please do let me know, how to safely merge these two layout files to one to avoid the conflict. As I need a switch, how will use in this case (as the application does not seem to respond to Manifest file)

If using android Studio, you should look at your build.gradle and check minSdkVersion !

Related

Overriding Library twice in android studio project manifest

Min sdkversion of my project is 8.I am using two libraries whose min version is 9 and 10.When I run my project it showed two errors that uses-sdk:minSdkVersion 8 cannot be smaller than version 10 declared in library Suggestion: use tools:overrideLibrary="com.brightcove.seamless" to force usage for one.When I did this it asked the same for other library.But since we can use tools:overrideLibrary once I dont know how to overcome this...please help...
Pre-Required:
Add Your library inside gradle with compile scope
In Side AndroidMenifest.xml file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xx.tech.cs.xx" >
And then above application start tag need to add
<uses-sdk tools:overrideLibrary="com.brightcove.seamless"/>
No need to change the minSDK version of your applications so it will go through with this I hope you can work this code in your program.
I have same issue for the other minSDK=14 version library and my application minSDK is 10 So I use this way.

What is android api level of my project

If the minSdkVersion of my project is 11 then what is the api level of my project? I mean how
to check whether I am working in api version 2, 3 or above? thanks.
You can actually keep the project's targetSDK at the same level, and just use a minSDK value.
What this means is that your application will target to build against a certain API, but it will let phones with lesser versions of Android than that API to also run the app. The catch is that you have to make sure you don't make any API calls that don't exist in the older versions of Android.
To change this, go to your AndroidManifest.xml and add the following inside of the xml node:
<uses-sdk android:minSdkVersion="3" />
This would set your minsdk to Android 1.5. Change it 4 for Android 1.6 and so on.
But if you really want to change the TargetSDK, right click on your project --> properties. Then click the Android tab on the left. Then check the box of the target API you want to build against.
List of api level is here and example is here
The minSdkVersion attribute only specifies the lowest API level on which your application will run.
If you did not set targetSdk or maxSdkVersion, then your app will run on the api level of the android device (if it is above or equal of minSdkVersion).
See http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
1) Right Click On Project
2) Click on "Properties"
3) Select "Android" from left Tab
Check targetSdkVersion in AndroidManifest.xml.
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />

How to combine two projects made under different API level?

I m creating a customised music player with some additional features in it.... for that i copied one project whose API level is 10 and pasted it in my current working project whose API level is 19..... i m getting an error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 10"...... I don't know how to make two API level work in the same project ..... please help....... i tried cleaning my project and rebuilding it ..... but after that it shows R cannot be resolved to a variable
Try changing the api level on the project, in your project manifest you will find this line:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
Change the targetSdkVersion to 19 to make it work with Android 4.4.

targetSdkVersion not similar in android manifest as selected while project creation

I am creating a project in android using eclipse.
Now my problem is when i create a android application project, I set Build Sdk version to 4.1 (API 16). But when i saw in manifest file the android:targetSdkVersion="15" . Can anyone explain me why this is happening ? see the below screenshots.
Thanks in advance
Updated Answer:
Here it goes,
Solution is,
goto:
Your
Directory\android-sdk-windows\tools\templates\projects\NewAndroidApplication\root
Open :
AndroidManifest.xml.ftl File
Change :
default :
<uses-sdk android:minSdkVersion="${minApi}"
android:targetSdkVersion="${targetApi}" />
Modified :
<uses-sdk android:minSdkVersion="${minApi}"
android:targetSdkVersion="${buildApi}" />
So the Problem goes here:
In the ftl file the attribute name ${targetApi} has been set, but we are selecting the buildApi value in the project creation window.
${targetApi} or ${buildApi} default value is the higher version , that means in your SDK tool it is API 15. So it is always 15 in the Manifest.
If you tried to create a new project with target API less than 10 or more than 15 anything , in the manifest it will be denoted as 15 only always.
Try this:
Create a project with API target 8 and see , manifest target will be 15 only. (Before modify the ftl file).
But project.properties has been updated properly.
So if you change ${targetApi} to ${buildApi} in the Manifest.xml.ftl, the problem solved.
It is a possible error in SDK tools revision 20, Even i updated the SDK tools itsn't resolved in the recent revision also.
Hope this one might be helpful for somebody, those who facing the same.
Older Answer:
It is showing for me too. But in my case, I selected API 14 and it is showing android:targetSdkVersion="15" in the manifest.
I guess some reason should be there... 4.0 or 4.2 , it is assigning 4.1 in the manifest... Or may be a bug with Eclipse IDE. Why cant you update the newer version of Eclipse IDE and try it out. This might be a IDE Problem only.
Can you see that Right click- Properties - Android , Checked one is same what you selected in the beginning.
And also project.properties has the same version what you selected in the beginning.
well the Project target you set is got set in the default.properties file if you change that and save it the the attached sdk will change you can try it.
the entry in menifiest is used after compilation on the device . don't know why it is taking wrong value.but in my eclipse it takes only minsdkversion and its value is same what i entered on start.however my point is it does not matter

Not able to use new resource identifiers in Android with targetSdkVersion defined in manifest

I'm developing an Android application that I'd like to be compatible with 1.5 (SDK version 4). I'm testing the application on 2.2 (SDK version 8). To do this, I'm including in the manifest file the line
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />
I thought this would allow me to use the newest manifest elements and APIs, but I'm getting a compile error whenever I try to use them. For example, I try to define the element installLocation to allow the app to be installed on the SD card, but Eclipse gives me the error
No resource identifier found for attribute 'installLocation' in package 'android'
Is there something else I have to do to get this to work? If I can't get this to work, what benefit is defining targetSdkVersion?
Make sure that you are using building against the android 2.2 jars. Right click on your Eclipse project, choose, properties, go down to Android and make sure the correct sdk is selected.
Change the build target by editing the project properties in Eclipse, and choose a target with at least API Level 8: ("I'm testing the application on 2.2 (SDK version 8)").

Categories

Resources