I set my minimum API version to 8, but the android SDK fails to warn me when I use functions that were added in API 14. Why is that?
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Right click on your project -> Android tools -> Run Lint.
The Lint tool will warn you. It also checks for incompleteness in your strings file etc.
It's your minimum supported level, not minimum required. It's reasonable to want to support up to the latest API (or API 14 for example) and gracefully degrade certain features all the way down to API 8. You can include functionality from API levels higher than your minimum, and simply check the version code at run time, and go down different code paths as necessary.
Please check you project target,
Right click on project--> property --> android --> API 8 --> apply --> ok
Then clean and refresh the project, your problem will be solve..:)
Related
I am utilizing the library BaseGameUtils and google-play-services_lib. In the project.properties file I could see the below mentioned line .
target=android-19.
What is the significance of this? Can I change this to "target=android-21". This is just to be in sync with the App's manifest file
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
Yes. You can change this, Depending target only, packages load for you in eclipse.
What is the significance of target=android-19?
target = android-X in project properties file means that Eclipse will not allow use methods or classes from SDK higher than X. It will show compiler errors.
How to change target:
Right click your project.
Then click "Properties".
Then select "Android" from the tree on the left.
You can then select the target version on the right.
NOTE: Before doing this make sure your project.properties and classpath are not in read-only mode otherwise it won't work. Also don't try to edit this file manually.
As a general rule I use the following guidelines
android:minSdkVersion="8"
Set this to the minimum level you want to support. Check which Android version that it actually relates to and make sure that you have compatibility with that version. For example, I think 8 = Android 2.2, which could be a problem if you are using google play services libraries. It is good practice to at least test that you app will work properly on this version using the emulator, because otherwise you will get a lot of errors and bad reviews.
android:targetSdkVersion="21" />
I usually set this to the maximum version that I have actually tested my app on. I thin 21 is Android 4.4, so you should be making sure that your app works correctly on this version of Android. At the least, you should test that it will run in an emulator that is configured with this version of Android.
Hope this helps.
If the minSdkVersion of my project is 11 then what is the api level of my project? I mean how
to check whether I am working in api version 2, 3 or above? thanks.
You can actually keep the project's targetSDK at the same level, and just use a minSDK value.
What this means is that your application will target to build against a certain API, but it will let phones with lesser versions of Android than that API to also run the app. The catch is that you have to make sure you don't make any API calls that don't exist in the older versions of Android.
To change this, go to your AndroidManifest.xml and add the following inside of the xml node:
<uses-sdk android:minSdkVersion="3" />
This would set your minsdk to Android 1.5. Change it 4 for Android 1.6 and so on.
But if you really want to change the TargetSDK, right click on your project --> properties. Then click the Android tab on the left. Then check the box of the target API you want to build against.
List of api level is here and example is here
The minSdkVersion attribute only specifies the lowest API level on which your application will run.
If you did not set targetSdk or maxSdkVersion, then your app will run on the api level of the android device (if it is above or equal of minSdkVersion).
See http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
1) Right Click On Project
2) Click on "Properties"
3) Select "Android" from left Tab
Check targetSdkVersion in AndroidManifest.xml.
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
Eclipse is giving me an error on the android:configChanges line in my AndroidManifest.xml:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
the error is:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
If I leave only keyboard|keyboardHidden|orientation there's no error, but compiler asks for the 4 remaining ones when I try and build.
I'm using GoogleAdMobAdsSDK-4.3.1.
Any ideas?
EDIT: I got it working by changing my project.properties (default.properties on SDK's lower then 14) file to:
# Project target.
target=android-14
and in my SDK Manager having the SDK Platform Android 4.0 - Revision 14 installed.
It should also work for SDK Platform android 3.2 - revision 13, so you just have to change the project.properties target to android-13 if that is the case. Basically you just have to make sure that the SDK revision is 13 or above, and that you have that SDK installed in the SDK manager and the project target in default/project.properties pointing to it.
Easy solution: (and NO you don't need to to change the min-sdk value !!)
Step 1:
Change "project.properties" file
# Project target.
target=android-13
Step 2:
In Eclipse
Project > Clean... > (select your project) > Clean projects selected below > OK
For a complete explanation with real example use this tutorial http://www.monkeycoder.co.nz/Community/posts.php?topic=1121
Cheers !
Simple answer: the mentioned config changes are not support in Android 2.1, have a look here:
http://developer.android.com/guide/topics/manifest/activity-element.html#config
e.g. uiMode needs API Level 8.
From the official AdMob Documentation:
Requirements
The Google AdMob Ads SDK for Android requires Android 1.5 or later. Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in default.properties to android-13).
have a look here: https://developers.google.com/admob/android/quick-start
So I think your tools version is not updated to at least Version 13.
For those using Eclipse there is an easier way:
Right click your project folder in the left "Package Explorer" pane and click Properties -> Android -> and in the "Project Build Target" list check off API 13 or up.
Note: this is the same effect as editing project.properties which is auto-generated anyway.
This will build your project against the Android 3.2 SDK which includes the terms that were previously unrecognized.
You may leave your android:minSdkVersion and targetSdkVersion values the same in your Manifest.xml.
Be warned though, if you don't set your targetSdkVersion to API 12 or lower (or don't set it at all) the Android system will assume that the android:configChanges values screenSize and smallestScreenSize (which were introduced in API 13) are accounted for and thus will be allowed to destroy-restart your activity. If you wanted to avoid this you must include those terms in your other <activity> tags (which probably only had keyboard|keyboardHidden|orientation until now).
However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Quote is from here.
I had the same problem so I came here.
I have downloaded the sample code from https://developers.google.com/admob/android/quick-start, I still had the problem with all answers above so I used the same admob sdk, they offer in the sample project. Redo the build jars thing, changed target to android-15, and used the same line they use:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
And it works!
Did you use
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize
or shorter one? If you change your target above 13 and use longer configChanges one (which I wrote), it should work.
Easy solution:
Change "project.properties" file to 21
# Project target.
target=android-21
All new Android apps created after October 14, 2011 will require an AdMob SDK that was released on or after March 15, 2011. This corresponds to version 4.0.2+ for Android. If you downloaded the library from our official download site, then you're already set. Otherwise you may have an old version of the AdMob SDK that was released prior to March 15, 2011, and your new app will not receive any ad impressions until you update your SDK.
Eclipse is giving me an error on the android:configChanges line in my AndroidManifest.xml:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
the error is:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
If I leave only keyboard|keyboardHidden|orientation there's no error, but compiler asks for the 4 remaining ones when I try and build.
I'm using GoogleAdMobAdsSDK-4.3.1.
Any ideas?
EDIT: I got it working by changing my project.properties (default.properties on SDK's lower then 14) file to:
# Project target.
target=android-14
and in my SDK Manager having the SDK Platform Android 4.0 - Revision 14 installed.
It should also work for SDK Platform android 3.2 - revision 13, so you just have to change the project.properties target to android-13 if that is the case. Basically you just have to make sure that the SDK revision is 13 or above, and that you have that SDK installed in the SDK manager and the project target in default/project.properties pointing to it.
Easy solution: (and NO you don't need to to change the min-sdk value !!)
Step 1:
Change "project.properties" file
# Project target.
target=android-13
Step 2:
In Eclipse
Project > Clean... > (select your project) > Clean projects selected below > OK
For a complete explanation with real example use this tutorial http://www.monkeycoder.co.nz/Community/posts.php?topic=1121
Cheers !
Simple answer: the mentioned config changes are not support in Android 2.1, have a look here:
http://developer.android.com/guide/topics/manifest/activity-element.html#config
e.g. uiMode needs API Level 8.
From the official AdMob Documentation:
Requirements
The Google AdMob Ads SDK for Android requires Android 1.5 or later. Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in default.properties to android-13).
have a look here: https://developers.google.com/admob/android/quick-start
So I think your tools version is not updated to at least Version 13.
For those using Eclipse there is an easier way:
Right click your project folder in the left "Package Explorer" pane and click Properties -> Android -> and in the "Project Build Target" list check off API 13 or up.
Note: this is the same effect as editing project.properties which is auto-generated anyway.
This will build your project against the Android 3.2 SDK which includes the terms that were previously unrecognized.
You may leave your android:minSdkVersion and targetSdkVersion values the same in your Manifest.xml.
Be warned though, if you don't set your targetSdkVersion to API 12 or lower (or don't set it at all) the Android system will assume that the android:configChanges values screenSize and smallestScreenSize (which were introduced in API 13) are accounted for and thus will be allowed to destroy-restart your activity. If you wanted to avoid this you must include those terms in your other <activity> tags (which probably only had keyboard|keyboardHidden|orientation until now).
However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Quote is from here.
I had the same problem so I came here.
I have downloaded the sample code from https://developers.google.com/admob/android/quick-start, I still had the problem with all answers above so I used the same admob sdk, they offer in the sample project. Redo the build jars thing, changed target to android-15, and used the same line they use:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
And it works!
Did you use
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize
or shorter one? If you change your target above 13 and use longer configChanges one (which I wrote), it should work.
Easy solution:
Change "project.properties" file to 21
# Project target.
target=android-21
All new Android apps created after October 14, 2011 will require an AdMob SDK that was released on or after March 15, 2011. This corresponds to version 4.0.2+ for Android. If you downloaded the library from our official download site, then you're already set. Otherwise you may have an old version of the AdMob SDK that was released prior to March 15, 2011, and your new app will not receive any ad impressions until you update your SDK.
i am making a gigantic app for android, and i start doing it some moths ago for android 1.5, but now i know that some of the things i need for my app only can be done if you are programming for 1.6 api.
there is a easy, fast and safe way to migrate my app from 1.5 to 1.6 without having to lose time?
thanks
Since you are going to a newer version, I don't think that any code changes will be needed.
You need to:
1) Update the minSdkVersion in the AndroidManifest.xml. For android 1.6 it should be minSdkVersion = 4. If you don't have that already, it is a good practice to always include it in the manifest. Add this line:
<uses-sdk android:minSdkVersion="4" />
as the last line before the closing tag of the manifest.
2) Change the target (again to 4) in your IDE or ant build scripts. In Eclipse right click your project, select Properties, Android and change the Project Build Target. Your project will recompile, when you click the Apply button.
Then, do a re-compile. I don't expect any errors to occur, but if they do, they will only be a few and you will be able to correct them quickly.
I use the following in my manifest file:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
At the same time I have configured Eclipse to use the Android 2.2 API. This way I ...
support small screens
can use the latest features (as long as I do it with care)
android 1.5 users can still use my app (as long as I make sure it degrades gracefully)
See http://developer.android.com/guide/appendix/market-filters.html