Search code examples
androidandroid-studioandroid-webview

Android Studio doesn't recognize WebView


I'm trying to build a webview and Android Studio is showing the messages below. Do you know how to fix this?

enter image description here


Solution

  • You have written java code in a kotlin file. In kotlin, you have to assign a value like this.

    val webView: WebView = findViewById(R.id.webView).
    

    If you want to write your code in java you have to select Java Class instead of Kotlin class/file while creating a new class or file. or in your case make sure to select Language Java while creating your project.