Skip to content Skip to sidebar Skip to footer

How To Find Which Api Level An Android Class Has Been Introduced?

I created a new Android project, targeting API 15 and using androidx. The autogenerated Hello world is: package com.example.myapplication; import androidx.appcompat.app.AppCompatA

Solution 1:

and I concluded that the API I needed was 28

That's not really what's going on here.

You are trying to import androidx.webkit.WebViewAssetLoader. The first segment of that package is androidx. Every androidx class comes from a library. You simply don't have that library, apparently.

In an ideal world, you would be able to visit the official JavaDocs for that class and be told which Jetpack library contains it. This is not an ideal world.

So, that's why I go through the trouble of maintaining AndroidX Tech, to fill in some of these documentation gaps. If you choose "W*" in the "Classes" drop-down, you will find WebViewAssetLoader is part of the androidx.webkit:webkit library, version 1.1.0 or higher.

Right now (2020-03-17), 1.2.0 is the most recent version, so add:

implementation "androidx.webkit:webkit:1.2.0"

to your dependencies in your module's build.gradle, and you should be good to go.

Post a Comment for "How To Find Which Api Level An Android Class Has Been Introduced?"