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.
Related
I am trying to secure WebView from cleartext traffic. As mentioned in the documentation. I have to set android:usesCleartextTraffic as false to achieve this. But this works on API level 23 and above. My minimum sdk is 22. How can I make sure app doesn't crash or create any problem on device running below API level 23 ? Or how can I programmatically set that attribute value in the application tag in Manifest.xml ?
As suggested in an article # Android Developers Blogspot:
You don’t have to set minSdkVersion or targetSdkVersion of your app to 23 (Android Marshmallow) to use android:usesCleartextTraffic. On older platforms, this attribute is simply ignored and thus has no effect.
Hope this solves your query.
When you use usesCleartextTraffic in manifest, you get the following warning :
Attribute usesCleartextTraffic is only used in API level 23 and higher
(current min is 19).
The default value of usesCleartextTraffic is as the following :
for apps that target API level 27 or lower is "true".
for apps that target API level 28 or higher default to "false".
This attribute was added in API level 23.
This flag is ignored on Android 7.0 (API level 24) and above if an Android Network Security Config is present.
https://developer.android.com/guide/topics/manifest/application-element
https://android-developers.googleblog.com/2016/04/protecting-against-unintentional.html
What is the difference between
android.util.ArraySet
android.support.v4.util.ArraySet
All methods seem to be identical.
As the page indicates, android.util.ArraySet was added in API level 23. android.support.v4.util.ArraySet is a copy in the backwards-compatibility support library, which allows you to use the class on older devices as far back as API level 4 (increased to level 14 in recent releases).
Making a program for Android L' using pdfrenderer the issue is
when 'm running the emulator with minsdk = 21
ERROR - "emulator-5554 disconnected! Cancelling 'com.example.andro_pdf_two.MainActivity activity launch'!"
when 'm trying to run the emulator at minsdk = 19
ERROR at logcat- java.lang.NoClassDefFoundError: android.graphics.pdf.PdfRenderer
and Call requires API level 21 (current min is 19): android.graphics.pdf.PdfRenderer#openPage
I have done everything as suggested - resetting adb, resetting preferences...but nothing seems to be working can anyone help???
Call requires API level 21 (current min is 19): android.graphics.pdf.PdfRenderer#openPage
clearly states that you need a min sdk version of 21 and your app has a current api level of 19
set this in your manifest and try
<uses-sdk android:minSdkVersion="21" />
PDFRenderer assumes minimum API level - 21.
You can use android-pdfview for API level less than 21.
I am confused about the target build and sdk usage
Lets say I have this code
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
//do xyz
}
Let say that I built against API 19 (kitkat) and my target api in manifest is 19 and my minimum supported api is 9
Now if a device with API 9 runs the above code, will it crash? I expect the answer is yes becasuse it will not understand what Build.VERSION_CODES.KITKAT means. However, what's the point of the check above then in first place?
Please help clarify this
Thank you
It won't crash. Simply the code within the if won't be executed. Build.VERSION_CODES.KITKAT is a constant field, and as you can read here, the constant fields are replaced with the numbers themselves by the compiler.
lesser versions of android will use the support library, if the check for kit-kat fails, it will revert to the closest possibkle form that version supports.... via the support library...
you cannot run you app on anything less than the minimum version, but it will find a way to run with less than the target version as long as its aboe the minimum
No, it won't crash, because its Build.VERSION.SDK_INT value is 9. It simply will not enter inside your if clause. Only devices that have API version 19 or above will run your code inside the if. Build.VERSION_CODES.KITKAT is equal to 19.
The code you posted won't crash because the class Build is created and compiled for every build of your app (as the R file) depending of the target API you set in the manifest
As you setup your target API to 19, the Build class will contain the field Build.VERSION_CODES.KITKAT because it exists starting from API level 19.
What does Advanceable Added in API level 16 mean? And how to use those two methods in Advanceable Api?I saw this interface in Launcher source code. I am not clear about the specification in android docs.Thanks.
It means that only devices with api level 16 or above knows/can use that method/class. And will fail to run if you put the code under a device with api level 15 or lower.