appcompat-v7 abc_alert_dialog_material.xml Lint error - android

my project has android:minSdkVersion="9" and uses appcompat-v7 lib.
When I run Lint, following error is shown:
Multiple annotations found at this line:
- To support older versions than API 17 (project specifies 9) you must also specify gravity or layout_gravity="start"
- Attribute "textAlignment" is only used in API level 17 and higher (current min is 9)
The corresponding code fragment is
<android.support.v7.widget.DialogTitle
android:id="#+id/alertTitle"
style="?attr/android:windowTitleStyle"
android:singleLine="true"
android:ellipsize="end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="viewStart"/>
Adding android:gravity="start" doesn't help because Gravity.START requires API level 14.
Also there is a Lint error
Call requires API level 11 (current min is 9)
for the following files in v7_appcompat lib:
android:attr/borderlessButtonStyle in notification_media_action.xml
android:attr/borderlessButtonStyle in notification_media_cancel_action.xml
android:attr/dividerHorizontal in notification_template_big_media_narrow.xml
android:attr/dividerHorizontal in notification_template_big_media.xml
What can I do?

use gravity and set left instead of start .
android:gravity="left"

Related

android:navigationBarDividerColor requires API level 28

Previously, I implemented light and dark navigation bar, however now tags as android:navigationBarDividerColor and android:windowLightNavigationBar require API level 28 when they previously required API level 27.
It seems API level 28 does not even exist as next API level is called P.
Is there any solution to this problem? Thanks in advance.
UPDATE: it seems to work now on API 27 with latest support libraries
When the "next upcoming API" is still under development, its "name" is a letter (P in your case).
Once the final version of the API is available, the "name" is changed form a letter to a number (P to 28).
Final version of Android API 28 (former Android P) is available since early June 2018. Just use the SDK manager and you'll be able to download it ;-)
Note:
Sources for "Android SDK Platform xx" (28 in your case)" is not available right away. (not available ATTOW)It can takes a few weeks before they are available for download from the SDK manager.
Today I've updated compileSdkVersion, targetSdkVersion and buildToolsVersionfrom 27 to 28. Now I'm facing the same issue as #Teďourek described.
While it was working for me on 27, since the upgrade I now get lint errors:
Error: android:navigationBarDividerColor requires API level 28 (current min is 19)
Error: windowLightNavigationBar requires API level 28 (current min is 19)
This is strange because according to the docs for both attributes it says:
"added in API Level 27"
My temporary fix is to move the two style attributes to v28/styles.xml instead of v27/styles.xml
Since I would like to use lightNavBar + color also on Android 8.1.0 as previously, I would be happy if anyone knows a fix!
With compileSdkVersion and targetSdkVersion set to 29 it seems to be correct.
The XML properties tell me it was added in API level 27.
Only the Java Window properties are added in API level 28.

Disable Multi-Window Support in Android

I'm trying to disable multi window support using android:resizeableActivity="false" inside application tag in the manifest file. But it shows this warning -
Attribute resizeableActivity is only used in API level 24 and higher (current min is 15)
Then I used "suppress with tool:TargetApi Attribute". This gave me RuntimeException: Worker exited due to exception:
What should I do now ?
Attribute resizeableActivity is only used in API level 24 and higher (current min is 15)
You can safely ignore that warning because Multi Window Support is only available from Android 7.0(API level 24) and above. On lower versions this line android:resizeableActivity="false" will simply be ignored.

Call requires API level 11 in v7_appcompat

I see a Lint error
Call requires API level 11 (current min is 9)
for the following files in v7_appcompat lib:
android:attr/borderlessButtonStyle in notification_media_action.xml
android:attr/borderlessButtonStyle in notification_media_cancel_action.xml
android:attr/dividerHorizontal in notification_template_big_media_narrow.xml
android:attr/dividerHorizontal in notification_template_big_media.xml
What can I do?

Android versions lower than API Level 21 using appcompat

In the following code, android:progressTint="#c9c9c9", android:secondaryProgressTint="#bebebe" and android:thumbTint="#a9a9a9" are API Level 21 features. However, I am currently using com.android.support:appcompat-v7:23.1.1. Will my app run on devices lower than API 21?
<SeekBar
android:id="#+id/teacher_intro_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:progress="10"
android:paddingRight="10dp"
android:progressTint="#c9c9c9"
android:secondaryProgressTint="#bebebe"
android:thumbTint="#a9a9a9" />
Yes they will work for API 21 and above, For lower versions they will be ignored. If you want for all versions use app compat seekbar as below.
<android.support.v7.widget.AppCompatSeekBar
android:id="#+id/teacher_intro_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:progress="10"
android:paddingRight="10dp"
app:progressTint="#c9c9c9"
app:secondaryProgressTint="#bebebe"
app:thumbTint="#a9a9a9" />
It will run, but it may not look correct. XML properties not recognized are ignored. In this case they will definitely be ignored- you aren't using an app compat version of Seekbar, so the compatibility library doesn't matter. (I don't know if there is an app compat version of seekbar, but even if there is you aren't using it).

Android SDK Check Not Working

I am trying to change the transition from default to sliding in. I would like to keep my minSdkVersion to be 3 however overridePendingTransition wasn't added until API level 5 (Android 2.0).
I tried creating an integer to represent the SDK version and then only override the transition when in Android 1.6 or less via a simple if statement.
int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
if(sdkVersion>=5)
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.fade_out);
Eclipse gives me a LINT warning stating "Call requires API level 5 (current min is 3): android.app.Activity#overridePendingTransition"
If I suppress this error and run it anyway it crashes on Android 1.6 or lower.
What is wrong with my code and how can I fix it? Any suggestions would be very appreciated!
In your android manifest file you have this ...
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="latest version" />
Change the min sdk version to 5 like show below
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="latest version" />

Categories

Resources