I am the author of a library for use in Android applications.
Currently checking how my library behaves with Android 14 (API 34).
Now, API 34 removes several existing methods.
For example, the method android.webkit.WebSettings#setAppCacheEnabled
has been removed.
https://developer.android.com/about/versions/14/behavior-changes-14#non-sdk-restrictions
It is important to note that my library uses WebSettings#setAppCacheEnabled
.
I have installed the library into a newly created application to make sure it works.
My library is built with targetSdkVersion 28
and compileSdkVersion 28
.
And the app I created for Android 14 was built with targetSdkVersion 34
and compileSdkVersion 34
.
The library and app’s AndroidManifest will be merged by the ManifestMerger and both should work with API 34.
I expected this test app to not work correctly because WebSettings#setAppCacheEnabled
was removed in API 34.
But in fact, contrary to my expectations, no error occurred.
Why is this?
Anyone who knows why, please tell me.
(I performed this test on an Android 14 (UpsideDown Preview) emulator.)
2
Answers
For now, the method you are using could just be added to unsupported category hence you are able to use it. It may be blocked in future.
Check this: https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces#list-names
Although I could probably be wrong, as you are the one with more experience and knowledge than me. So sorry?
if your library has lower api than the application, there will be no problem.
but if application has lower api version that your library, you may see some unexpected behavior