installLocation identifier not found in eclipse Android package - android

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!
:=)

Related

android version compatibilty

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.

AdActivity not being declared in manifest......but I am using sdk v 3?

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.

Why I cannot use attribute installLocation in the Manifest file?

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.

Can’t use android:xlargeScreens="true"?

I am making app for phones, but I wan’t them to be usable on tablets. I don’t know why can’t. I use this in my android manifest file:
android:xlargeScreens="true"
I get this error:
error: No resource identifier found for attribute 'xlargeScreens' in package 'android'
This is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cro.perger.bonbon"
android:versionCode="5"
android:versionName="1.4">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".bonbon"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Broadcast Receiver that will process AppWidget updates -->
<receiver android:name=".HelloWidget" android:label="#string/w_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/hello_widget_provider" />
</receiver>
<receiver android:name=".SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.READ_SMS"/>
</manifest>
What should I do?
Please check your project Build Target To support xlarge screen your project build target should be atleast android 2.3.3 adk.
In Eclipse -?right click on project -> Properties -> Android -> Select Project Build Tagrget as 2.3.3 or onwards
My application supports android versions 1.5 to the latest version and this is what I have in my manifest:
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
This is what shows up on the android market developer site for my app:
Screen layouts: SMALL NORMAL LARGE XLARGE
Required device features
android.hardware.touchscreen
This application is available to over 555 devices.
Also, my project build target is 2.3.3, but I still have many installs on devices running android 3.0
And this is just a guess, im not sure about this, but wouldn't including permissions like CALL_PHONE filter your application from search on a tablet since they dont have that feature?
It looks like you need to build different APKs for older and new versions. Checkout out the blog posted on http://android-developers.blogspot.com/search/label/Android%20Market about multiple APK support: "Multiple APK support gives you a variety of ways to control app distribution. For example, you could use it to create separate APKs for phones and tablets under the same product listing."
You need to use at least android API Level 9 for android:xlargeScreens to be recognized in AndroidManifest.xml.
For this make sure in your default.properties file you have target=android-9 or higher. This also can be set using Project Properties, in Android section.
The problem is your minSdkVersion.
The xlargeScreens-attribute was introduced in API-Level 9. Since you specified that your application will probably run under API-Level 4, android can't find this attribute.
Change the minSdkVersion-attribute to 11 and it should work.
The targetSdkVersion-attribute, which you set to be 11 only indicates that the App was developed to target this version (so it's "recommended"), but the minSdkVersion specifies the minimum API-Level, see here.
What is your API level set to? It says in the documentation that it requires API 9 or higher. 9 is 2.3. See this link which says:
android:xlargeScreens Indicates whether the application supports extra
large screen form-factors. An xlarge screen is defined as a screen
that is significantly larger than a "large" screen, such as a tablet
(or something larger) and may require special care on the
application's part to make good use of it, though it may rely on
resizing by the system to fill the screen. The default value for this
actually varies between some versions, so it's better if you
explicitly declare this attribute at all times. Beware that setting it
"false" will generally enable screen compatibility mode. This
attribute was introduced in API level 9.
android:xlargeScreens :
This attribute was introduced in API level 9 (Android 2.3.3). If you have your build target lesser than API level 9, then you will get error "No resource identifier found for attribute 'xlargeScreens' in package 'android"
Set your build target to API level 9 or above and this error will vanish.

Application does not specify API level

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

Categories

Resources