Suppress AndroidManifest.xml minSdkVersion related warning - android

As recomended here http://developer.android.com/guide/practices/screens_support.html for compatibility reasons my AndroidManifest.xml contains this:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>
This generates warning in eclipse:
Attribute minSdkVersion (3) is lower
than the project target API level (4)
Are there any means to suppress this warning or get rid of it any other way? It is really annoying.

In short, there is no built-in way to do this that I know of.
Here's a discussion from last August.
And here is a Xavier Durochet's response.
It looks like you can manually remove it according to Mark Murphy's response in the first thread:
Or, you can modify SetupTask.java, eliminate this test (lines 297-308 in
the code indexed by Google Code Search), and build it into a custom
version of the Android Ant extension
There is a feature request that may deal with this, but who knows when it will be implemented.

The answer from 2011 is no longer accurate. It was fixed in ADT 17 according to this bug.

This warning is an usual one. I am using minSdkVersion to support Android 1.5 and I am building for Android 1.6 to support small screens. You can build your application with the latest Android 2.3 library, but still support a lower version.

Related

How can I add foregroundServiceType to a library manifest while maintaining backwards compatibility?

My library project has a location service, and per Android Q requirements it sets the android:foregroundServiceType="location" attribute in the manifest. When an app module uses my library and compiles against API level 28, it fails with the following error:
AndroidManifest.xml:57: AAPT: error: attribute android:foregroundServiceType not found.
How can my library maintain compatibility with older versions, while making sure the functionality works on Android Q?
I had same error and after migrating to Androidx and updating compileSdkVersion from 28 to 29 my issue was resolved. So please do these changes and you can get your solution
My goal is to avoid breaking anyone's build when the library version is updated, and at the same time avoid forcing the developer to compile against API 29. It seems I have two choices:
Provide a separate library so that developers compiling against API 28 and lower don't get impacted;
warn developers targeting the new version to replace the service definition in the manifest using tools:node="replace".
The problem with the first approach is that I will need to maintain two libraries for some time. The problem with the second is that developers must remember to revert the change once they update the SDK version.
In my case, I will go with the second approach. By passing an explicit foreground service type to the startForeground method when targeting Android Q, I can cause a crash if the type is not set in the manifest. The developer can therefore catch this when targeting Android Q and revert the manifest change to fix it.

Google Play Services : target=android-19 in project.properties

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.

"Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden| orien"... in AndroidManifest.xml

Before all, i am a rookie in Android, and i am using API 10 (Gingerbread).
I am developing a simple game with libgdx. But i just install everything for start to work and... in the AndroidManifest.xml this line:
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
Got the next error in console:_
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenSize').
I have found in Stackoverflow this answer, i changed to API 13 and works... but i think there should be a better solution than don't make the app less compatible because one line of code (there is much people that still using Gingerbread). There is another way to fix this?
Configure your libgdx Android Manifest like this and specify both min and target sdk version:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19" />
You can use API 5 as the minimum android version as this is what libgdx still supports. Don't get confused about the meaning of the target sdk version: this basically means that you have tested it against latest android version, it doesn't mean that it won't run on previous versions, because you have specified a min sdk before. Rule of thumb: put min-sdk as low as possible and target-sdk as high as possible.
Configuring it that way your game should still run in old devices and using configChanges like this will work as well:
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
I have just recently launched a game with configurations like this and works like a charm even on Gingerbread ;-)
I've spent three days of my life (and almost my marriage), but I have one different answer. Is hidden. I had correct the minsdk, the target. The, why??? because of the |. I had the elements of configChanges sepparated by /, but that's not correct. Yu have to sepparate them with | . But in cursive is difficult to realise what is. So, be careful with the |
I hope this answer helps!!
Just lost a lot of time too. This was the issue:
Caused by - AAPT tool does not allow density value for the configChanges until API level 24
Fixed in - 2017.3.0b8, 2018.1.0a1, will also be backported to 2017.2, 2017.1 and 5.6 patch releases
link to unity forum
So apparentlly it's a bug in the latest version of the unity editor at the time of writing. (2017.2.0f3)
It adds 'density' to configChanges in AndroidManifest.xml which is not supported in android versions below 7.0 (API level 24).

ActionBarSherlock Beginners Setup Error

I am attempting to set up ActionBarShelock for the first time using Eclipse on Windows 7.
I followed these instructions: http://actionbarsherlock.com/usage.html
ActionBarSherlock project.properties:
android.library=true
# Project target.
target=android-15
ActionBarSherlock AndroidManifest.xml:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11"/>
My error in Lint: Call requires API level 11 (current min is 7): android.widget...
Or if I ignore the error on ActionBarSherlock and import it as a library then I cannot compile my project because any references to the library are not recognized and I get no resource errors.
I looked up many people with similar problems and it was always an API build target error. Thank you for your suggestions!
A few things:
Make sure you are compiling your application with Android 4.0 or newer (API 14+). You must do this in addition to just the library.
Ensure you are calling getSupportActionBar rather than getActionBar. This is likely the source of your errors for lint.
While targeting API 11 is valid, many things are gained by targeting 14 or higher. Try to do that if you can.
I found it! The JDK compliance level was set to 1.5. After setting it to 1.6 it worked.
It says this right in the Action Bar Sherlock website in the requirements section but I made the error of assuming Eclipse was using the latest JDK settings.
Definite beginners mistake.
Thank you for your help.
Are you using an old version of ActionBarSherlock perhaps? As the current version, 4.1.0 has the targetSdk set to 15.
I think some older version can have a problem with newer ADT/lint or similar.

How i can migrate my app from 1.5 to 1.6 api fast and safe?

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

Categories

Resources