Bilal Bilal -4 years ago 127
Android Question

Android Kotlin Protected property exposes its private type ExpiresLayout

I converted my Java Activity class using Android Studio Kotlin plugin.

Android Studio > Code > 'Converting Java code to Kotlin'


I am getting this error.


Error:(109, 19) 'protected (in Fragment)' property exposes
its 'private' type ExpiresLayout


Code

protected val mExpiresLayout = ExpiresLayout.NORMAL


Any Idea? Thanks

Answer Source

You can either make it private, or if you need ExpiresLayout to be accessible outside your class then make that protected.

What's happening is that by declaring the mExpiresLayout value as protected you're exposing a private class outside its domain (it's visible to subclass and other classes in the same package) which is illegal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download