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.
Related
I can't work out any reason at all why I am seemingly unable to set a minSdkVersion for my application from the manifest. I am compiling from the terminal using Ubuntu OS - simply using> ant debug
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="self.redway.menubardemo"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
minSdkVersion="11"
targetSdkVersion="20"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name="MenuBarActivity"
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>
and yet when I compile the output in the terminal says:
[gettarget] Project Target: Android 4.4W
[gettarget] API level: 20
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
[echo] ----------
And although it runs the application is not giving me the action bar or the holo theme I expect when my min target is set at 11.
Is there something I need to do to the build path or something tricky. There is literally nothing to be found on the subject on here or google generally. Totally stuck.
Use the android namespace prefix with your attributes. That is, android:minSdkVersion instead of default minSdkVersion.
The same problem is there with targetSdkVersion, too.
use this :
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="20" />
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.
There are numerous helpful posts regarding this topic but all require me to use a later sdk than I have written my app for.In an effort to make my app as backwards compatible as possible I chose to create it using Android 1.5 (sdk v 3).
With the code suggested for declaring the manifest I have some issues with eclipse giving me an error as the code refers to later sdk functions not available in Android 1.5
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
/>
Eclipse is telling me that everything after orientation is the problem.
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
Can someone please point me in the right direction insofar as code for the manifest or how to compile for a later target?
Cheers!!
Ok.....here is the code from the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ohmywebdesign.trigsolver"
android:versionCode="5"
android:versionName="1.3" >
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:targetSdkVersion="8" />
<uses-sdk android:maxSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<meta-data android:value="YOURPUBIDHERE" android:name="ADMOB_PUBLISHER_ID" />
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name=".Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Something like this:
<uses-sdk android:minSdkVersion="3" />
<uses-sdk android:targetSdkVersion="8" />
<uses-sdk android:maxSdkVersion="15" />
In you manifest will allow you to do what you want.
Also, be sure you have the latest AdMob SDK ie version 4.3.1 http://code.google.com/mobile/ads/download.html
and that you include
<meta-data android:value="YOURPUBIDHERE" android:name="ADMOB_PUBLISHER_ID" />
As MisterSquonk's comment on the question stated, some of the configChanges values were introduced in API levels higher than that of 1.5. Merely changing the values of the minimum/target/maximum API levels in the manifest alone won't solve your issue, you have to make sure to build against an SDK level that declares those values.
For Ant-based builds, this would entail altering the target property's value in project.properties; I don't use Eclipse for my Android projects, so I'm not 100% sure, but here's an excerpt from the Eclipse/ADT documentation that seems relevant to what you'd need to do:
Note: You can change your the Build Target for your project at any time: Right-click the project in the Package Explorer, select Properties, select Android and then check the desired Project Target.
Of course, if you do this, you have to ensure not to directly use any classes/methods from API levels higher than your minimum, or your application will fail at runtime when run on devices implementing lower API levels.
Remember, the manifest is only used at runtime on the device (and by most distribution channels, such as the Android Market). The build target is something completely separate which is used at compile-time.
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!
:=)
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