Android: installLocation - android

I'm new in Android, I was trying to set installLocation in manifest, I found here that my minsdk should be Ver2.2(froyo) and above.
here in my mainfest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ir.royalplus.guessyourcar"
android:versionCode="1"
android:installLocation="auto"
android:versionName="3.0" >
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" />
but I still have this error:
error: No resource identifier found for attribute 'installLocation' in package 'android'
what is wrong with my code?!

android:installLocation was introduced with API level 8. Since your minSdkVersion="7" is lower than 8 it is not supported. To solve this issue set your minSdkVersion to 8 or higher.
Source

From the documentation - installLocation, Introduced in: API Level 8. Your current min is 7, so it'll throw an error. To fix this, just change your min to 8.

Related

Android Studio API level error

I'm trying out the new Android Studio and it is not recognizing the current API level
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wiproeag.smartbuy"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
...
</manifest>
Any ideas?
A possible workaround for this is to include the Android compatibility libraries. Try this one first and get back with the results. I'va also encountered such a problem and it worked for me.

Not targeting the latest versions of Android

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?

How to set Android version in Eclipse?

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

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.

minSdkVersion Error when uploading APK to Android Market

When I try uploading the APK to the Android Market, I get this message:
Market requires the minSdkVersion to
be set to a positive 32-bit integer in
AndroidManifest.xml.
But I have defined android:minSdkVersion in my Manifest...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mkainc.tabwidget"
android:versionCode="7"
android:minSdkVersion="7"
android:versionName="2.1">
...
Your SDK information needs to be contained in a uses-sdk tag:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
See the documentation for details.

Categories

Resources