Why am I unable to set minSdkVersion - android

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" />

Related

minSdkVersion 8 cannot be smaller than version 9 declared in library - post AdMob

I've added the ability to enter admob classes in my project with Android Studio , as well .:
The problem is that since I added this option , I go into conflict sdk credo..non are very handy Android sorry.
How can I fix the problem ? I should then bring up an interstitial banner :
InterstitialAd interstitialAd ;
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygame.game.android"
android:versionCode="1"
android:versionName="1" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
<activity
android:name="com.mygame.game.android.AndroidLauncher"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Error:
Error:(7, 5) uses-sdk:minSdkVersion 8 cannot be smaller than version 9
declared in library C:\Users\myuser\Documents\my
game\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\8.4.0\AndroidManifest.xml
Error:Execution failed for task ':android:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library
C:\Users\myuser\Documents\mygame\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\8.4.0\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="com.google.android.gms.ads" to
force usage
how to solve ???
This error is telling you that the play-services-ads library (aka AdMob) supports a minimum SDK of 9, but your application is trying to declare a min SDK of 8.
Since that library only supports back to version 9, your application cannot support anything older than that.
how to solve ???
Either stop supporting version 8 of Android (which currently accounts for just .1% of users globally), or remove the ads library.

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.

can't install apk on motorola milestone droid

I have an apk which i am unable to install on my motorola milestone droid. It gives an error not an apk file! Any suggestions? I am using android 2.1 and the code was developed on Android 3.1 platform.
this is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acb.xiynove"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="12" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".ACB_OnlineScreenActivity"
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>
You have specified in AndroidManifest that your .apk file can not be installed on systems lower then with API Level 12 (Android 3.2):
<uses-sdk android:minSdkVersion="12" />
In your specific case this means that you cannot install this .apk to Android 2.1 (API Level 7). You should either lower to android:minSdkVersion="7", or install .apk only to devices with Android 3.2.
As a side note, my guess is that you meant to use targetSdkVersion instead of minSdkVersion. But I might be wrong, as this depends on what APIs you're using.

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.

Running the Android emulator

I am trying to run the emulator and each time I tried it it gives me the same error message 'Application stopped unexpectedly' I tried sorting it by killing the adb process in the task manager. The log cat error says:
WARNING: Application does not specify an API level requirement!
Device API version is 7 (Android 2.1-update1)
I do not know how this could be sorted, or if there is any other issue.
Please help, thanks!
Amrita
I guess the solution for your problem is:
In your manifest there should be something like this
<uses-sdk android:minSdkVersion="int" />
Now just change the number to the desired version number. Additionally you should also change the value of the target in the default.properties file.
AdnroidManifest.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jaxx.progressbarexample"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".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>
**<uses-sdk android:minSdkVersion="9" />**
</manifest>
One more thing to remind,you specify the min sdk version in your AndroidManifest.xml file similar to what your emulator target sdk version which you specify while creating your AVD.or create a new AVD with a target sdk of your application
.

Categories

Resources