2

I tried to run the following program in an Android Studio scratch file:

import android.net.Uri
println (Uri.encode("?"))

But it fails with the following error:

Unresolved reference: android

But this seems to work:

import java.net.URLEncoder
println (URLEncoder.encode("?", Charsets.UTF_8.name()))

How to tell Android Studio about android?

ceving
  • 21,900
  • 13
  • 104
  • 178

0 Answers0