https://kotlinlang.org logo
p

Philip Blandford

08/28/2020, 8:15 AM
Having trouble building code that incudes a WebClient, using alpha01 and Canary 8: • com.android.tools.r8.errors.b: Space characters in SimpleName 'Boolean$fun-shouldOverrideUrlLoading$class-$no name provided$$val-client$fun-$anonymous$$arg-1$call-MyApplicationTheme$fun-$anonymous$$arg-1$call-setContent$fun-onCreate$class-MainActivity' are not allowed prior to DEX version 040 
Copy code
val client = object : WebViewClient() {
    override fun shouldOverrideUrlLoading(
      view: WebView,
      request: WebResourceRequest
    ): Boolean {
        view.loadUrl(request.url.toString())
        return true
    }
}
s

satyan

08/28/2020, 8:26 AM
I don’t think it’s related to compose. I saw a similar commit fixing it in Jetnews: https://github.com/android/compose-samples/commit/dc9b832bc9830ed92af52627f44e75311cc3c175
Try to create a custom WebviewClient class instead of using
object : WebViewClient
p

Philip Blandford

08/28/2020, 8:31 AM
Ah thanks, that's worked around it.
s

satyan

08/28/2020, 8:53 AM
Or maybe it’s linked to compose kotlin compiler extension. I couldn’t find the issue mentioned by @cb in the commit. Might be an internel bugtracker 🤷
t

Timo Drick

08/28/2020, 11:24 PM
The problem is the anonymous class. use
Copy code
'com.android.tools.build:gradle:4.2.0-alpha07
or use named classes only or wait until the bug is fixed
3 Views