I have a warning when trying to test theme on latest Android SDK Package 4.2.
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.themetest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme" >
<activity
android:name="com.example.themetest.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Not targeting the latest versions of Android; compatibility modes
apply. Consider testing and updating this version. Consult the
android.os.Build.VERSION_CODES javadoc for
details. AndroidManifest.xml /ThemeTest line 7 Android Lint Problem
I am using a custom theme called 'AppBaseTheme'. My question is what exactly Consult the android.os.Build.VERSION_CODES javadoc.. How could I solve this problem?
It says this because of targetSdkVersion="16". API 16 is Jellybean 4.1 and 4.1.1, while Jellybean 4.2 is API 17.
Try using:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Also, keep in mind that this is a Lint warning. These warning exist to help you better your code and make it easy to maintain, while being compatible with the latest Android changes. Ignoring this will not cause you any immediate problems.
EDIT: With Android 4.3, the latest SDK version is now 18, so you should use:
...
android:targetSdkVersion="18" />
EDIT 2: With Android 4.4, the latest SDK version is now 19, so you should use:
...
android:targetSdkVersion="19" />
EDIT 3: With Android L, you must use the following values, as described here:
compileSdkVersion="android-L"
minSdkVersion="L"
targetSdkVersion="L"
EDIT 4: With Android L's public release, you must use 21 instead:
...
android:targetSdkVersion="21" />
20 was used for 4.4W, or for Android Wear.
EDIT 5: With Android M's public release, you must use 23 instead:
...
android:targetSdkVersion="23" />
In the future please consult the official Android documentation to keep yourself up-to-date with the latest Android API Levels.
You should not use android:maxSdkVersion="17" because it means that if someone using your app updates its android OS to a version greater than 17, your app will be removed.
This lint message is telling you that compatibility mode will be automatically applied to any features you may have used that are not available in later versions than your declared targetSdkVersion of 16 (and, it is also telling you that there are such later versions - e.g., 17).
These automatic compatibility mode adjustments may not be as ideal as what you could accomplish yourself by using whatever features were added in later (than level 16) versions to replace the functionality of the level 16 ones that you may have used, which have been removed in later versions (if any). But everything should still continue to work in later versions (due to the adjustments made by the compatibility code that is automatically applied for running on versions higher than your declared targetSdkVersion's API level); it just may not work as well as your own custom detection of, and use of, the new features (when your app detects that it is running in the later versions that have those features) would have worked.
Here is a discussion, with examples, of minSdkLevel vs. targetSdkLevel:
Android Min SDK Version vs. Target SDK Version
Another thing you will want to consider is the relationship of the Project Build Target (the level of the SDK used to compile your app) to the targetSdkLevel:
Difference between "Build Target SDK" in Eclipse and android:targetSdkVersion in AndroidManifest.xml?
Always go with the latest android version as your target SDK to get more benefits.
Targeting a recent API level also allows your app to take advantage of the platform's latest features to delight your users. Furthermore, as of Android 10 (API level 29), users see a warning when starting an app for the first time if the app targets Android 5.1 (API level 22) or lower.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="29" />
Please refer to this developer site for more details.
https://developer.android.com/distribute/best-practices/develop/target-sdk
Its a warning message if you want to solve it then you can set android:maxSdkVersion="17" but you have to take care of the fact that if someone currently using your app and upgrade his android OS to greater version than 17 then your app will automatically remove because of unsupported version.. So take care of this fact also..
Add xmlns:tools="http://schemas.android.com/tools" tools:ignore="OldTargetApi".
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.themetest"
android:versionCode="1"
android:versionName="1.0" xmlns:tools="http://schemas.android.com/tools" tools:ignore="OldTargetApi">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
From: Stuck on why my android app wont work?
Related
I have developed and Simple android application in Java and also uploaded it on play.google.com. I uploaded successfully and also published well and I made all steps to published and save the app.after publishing it is showing on app store.Problem is that when I searched the app on my android device then it give the error of "This item is not compatible with your device". I don't understand why this error is being occurred. Kindly any one tell me how can I make and android app which is compatible with all versions of android or any other method through which my app should sun on all android devices.
Here is my manifest file code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sml.sml.pkg"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".SMLActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
There are a number of reasons why this might occur. Most likely you are either:
Not specifying the correct minimum SDK your application is compatible with. To do this, you should add to your AndroidManifest.xml the following.
<uses-sdk android:minSdkVersion="#" />
where the # should be replaced with the integer corresponding to the minimum SDK number your application supports. For example, if your application has features that are supported by Gingerbread (API 10) but not Froyo (API 8), then you should specify the number to be 10. Note that you rarely want to add the android:maxSdkVersion attribute, as this will prevent devices from using your application when new SDK versions are released.
Your application uses a feature that is not supported by your device. This might be the case if you have declared in your manifest the <uses-feature> tag.
Edit:
I just saw the code you added to your original post. Your code, specifically, <uses-sdk android:minSdkVersion="15" />, will prevent Android devices running Android versions lower than 15 from using your device. To allow older versions to use your application, you'll need to lower this number. Make sure you are 100% certain that the SDK you choose supports 100% of the features that your application requires.
you need to provide android:minSdkVersion & android:maxSdkVersion in AndroidManifest.xml.
i think your mobile version is not supported to the version you implemented in your project. So, in Androidmanifest file just follow the following changes as shown......
Androidmanifest.xml
<uses-sdk android:minSdkVersion="7" android:maxSdkVersion="11"/>
provide those versions based on your mobile version also. if you are using android 2.2 means its API level is 8. so provide minSdkVersion as 8.
I've written a first app for Android with Eclipse. I've published it but I'm noticing that on the app page it doesn't show the Android minimum version supported, you can see it here:
https://market.android.com/details?id=com.yellowhouse.everydayquotes
I've searched in the project files and I've found that in project.properties there is the following line:
target=android-15
is that the correct place to set the Android version? Am I missing something? Why does it not appear on the page? Thanks.
the "target=android-15" that you have is for your emulator or your test device which you want to launch your app with
To answer to your question, you need to set the minSDK version in your android manifest file
like that
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tfe.rma.ciss.be"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
</manifest>
To set the minimum required android version for your app, you need to use uses-sdk element inside your AndroidManifest.xml file:
<manifest ...>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="7"/>
...
</manifest>
Version 4 means Android 1.6. Read up information on android manifest to see the correct sdk version numbers: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
when I tried to add
android:installLocation="auto"
in my AndroidManifest.xml file I found the following error in eclipse
error: No resource identifier found for attribute "installLocation" in package "android"
how to overcome this problem ?
edited :
My Manifest file is :
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0"
package="com.xxxx.yyyy">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:label="#string/app_name" android:icon="#drawable/icon">
<activity
android:screenOrientation="portrait"
android:name=".StarterActivity"
android:label="#string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:screenOrientation="portrait"
android:name="GamePlayActivity"></activity>
<activity
android:screenOrientation="portrait"
android:name="LoginActivity"></activity>
<activity
android:screenOrientation="portrait"
android:name="SignupActivity"></activity>
<activity
android:screenOrientation="portrait"
android:name="MainMenuActivity"></activity>
<activity
android:screenOrientation="portrait"
android:name="InfoActivity"></activity>
<activity
android:screenOrientation="portrait"
android:name="ViewScoreActivity"></activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"></activity>
</application>
<uses-sdk
android:minSdkVersion="7"
/>
</manifest>
error is showing in line
android:installLocation="auto"
Thanks
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
. . .
</manifest>
Introduced in: API Level 8.
Backward Compatibility
The ability for your application to install on the external storage is a feature available only on devices running API Level 8 (Android 2.2) or greater. Existing applications that were built prior to API Level 8 will always install on the internal storage and cannot be moved to the external storage (even on devices with API Level 8). However, if your application is designed to support an API Level lower than 8, you can choose to support this feature for devices with API Level 8 or greater and still be compatible with devices using an API Level lower than 8.
To allow installation on external storage and remain compatible with versions lower than API Level 8:
Include the android:installLocation attribute with a value of "auto" or "preferExternal" in the element.
Leave your android:minSdkVersion attribute as is (something less than "8") and be certain that your application code uses only APIs compatible with that level.
In order to compile your application, change your build target to API Level 8. This is necessary because older Android libraries don't understand the android:installLocation attribute and will not compile your application when it's present.
When your application is installed on a device with an API Level lower than 8, the android:installLocation attribute is ignored and the application is installed on the internal storage.
Caution: Although XML markup such as this will be ignored by older platforms, you must be careful not to use programming APIs introduced in API Level 8 while your minSdkVersion is less than "8", unless you perform the work necessary to provide backward compatibility in your code. For information about building backward compatibility in your application code, see the Backward Compatibility article.
==>
go to eclipse project settings -> SEction "Android" and select at least API Level 8 there.
referenced by user "user370305" as comment:
change your application's api version from properties make it 8 or greater. then its work fine. Look at my edited answer. – user370305 Oct 13 '11 at 8:06
thx && good luck!
:=)
Just a simple XMl file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto"
>
<application android:label="#string/app_name">
<activity android:name=".MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Yet, I receive an error
"No resource identifier found for attribute 'installLocation' in
package 'android'"
Why is this happening?
EDIT
It seems that this is an issue with IntelliJ. At least mine. This is the screen of Project Structure. I clicked Android 2.3.3 SDK and changed its build target. I did this after the attribute
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
did not do the trick. Any ideas?
You must specify the android:minSdkVersion and android:targetSdkVersion and compile your APK using, at least, API 8. For instance:
....
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8" />
</manifest>
This will compile the APK using API 8. Handsets running Froyo or above, will be able to use that feature. Eclair and older versions won't (in this case, only Eclair).
The error happens because you are trying to compile the project with an API 7 or older, and installLocation was added on API 8.
Short answer: set your build target to an API level >= 8 and your problem is solved.
Changing the build target is easy:
Right-click the project in the Package Explorer, select Properties, select Android and then check the desired Project Target.
Explanation:
The android:installLocation attribute is available since API level 8, so you'll need to make sure your build target is set to API level 8 or higher, else it will not compile your application.
android:minSdkVersion can be less than 8 and your application will still work on older devices, but devices with API level < 8 will simply ignore the attribute.
I am just beginning to use Eclipse for Android applications.
I have installed Eclipse 3.5.2 and Java 5
AVD is Android 2.1 API 7
My initial Hello Android program ran fine but will not run again.
getting the following error:
[2010-07-25 09:47:31 - HelloAndroid] WARNING: Application does not specify an API level requirement!
[2010-07-25 09:47:31 - HelloAndroid] Device API version is 7 (Android 2.1-update1)
searched the forums but could only find a refernece to manifest file to be sure following was set:
<uses-sdk android:minSdkVersion="3" />
my manifest file does not contain that line:
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandriod" android:versionCode="1" android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloAndroid" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I have checked the adv mgr and it is set to 7
In Eclipse i went to properties -> Android and set it to 7
get same warnings
Well, if Eclipse is, for whatever reason, not generating that line for you, by all means you can add it yourself.
Add the line:
<uses-sdk android:minSdkVersion="3" />
to your manifest, right before the ending manifest tag.
You should also include
<uses-sdk android:minSdkVersion="7" />
in your manifest file, if it is not already there. It's not clear from your question, but seems that it isn't.
For future reference about API levels, see this page
It appears that there is a bug in the Android SDK Tools revision 16 that requires the correct ordering of the uses-sdk tags. If you're using both targetSdkVersion and minSdkVersion, order them as follows:
<uses-sdk android:targetSdkVersion="10" /> <!-- before minSdkVersion -->
<uses-sdk android:minSdkVersion="7" /> <!-- after targetSdkVersion -->
Reversing the order will give the warning message and pop up the device selection window. I therefore recommend writing this in a single line:
<uses-sdk android:targetSdkVersion="10" android:minSdkVersion="7" />
The manifest should only contain a single element, it's an error to use more than once.
In ADT 17, we have a new lint warning which detects and reports this problem:
$ lint --version
lint: version 17
$ lint --show MultipleUsesSdk
MultipleUsesSdk
---------------
Summary: Checks that the <uses-sdk> element appears at most once
Priority: 6 / 10
Severity: Error
Category: Correctness
The <uses-sdk> element should appear just once; the tools will *not* merge the
contents of all the elements so if you split up the atttributes across
multiple elements, only one of them will take effect. To fix this, just merge
all the attributes from the various elements into a single <uses-sdk>
element.
More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
you have to specify the API level in your code and it should be in a single line.
uses-sdk android:targetSdkVersion="19" android:minSdkVersion="4".
Target should be latest one. It might help you as it worked for me. Thanks