Anko: android studio 3.0-alpha4 is not supported anko layout preview

Created on 23 Jun 2017  ·  29Comments  ·  Source: Kotlin/anko

My android studio 3.0-alpha4 is not supported
auko library and plugins version 0.10.1
image

Most helpful comment

come on, JetBrains, did Google told you that anko is not the right way and you discontinued the library ?

All 29 comments

I have the same issue.

It does not only preview, but does not render in programm neither.

it shows blank in android phone or in emulator.

@benluo Running on the phone no problem, that is, can not preview

I cannot show in the phone (n5, android 6.0) either.

Im seeing the same issue, easily replicated with

class StartActivity: AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        StartLayout().setContentView(this)
    }
}

class StartLayout: AnkoComponent<StartActivity> {

    override fun createView(ui: AnkoContext<StartActivity>): View {
        return with(ui) {
            linearLayout {
                lparams(width = matchParent, height = matchParent)
                backgroundColor = ContextCompat.getColor(ctx, R.color.darkBlue)
            }
        }
    }
}

It seems to be working now though after dropping from beta2 to beta1

In Android Studio 3.0-alpha 5 (Canary 5) the issue still exists. There is no preview item to be selected.

same behavor. It shows blank in real phone (n5 with Android 6).

@elton2048 and @benluo make sure your appcompat dependency is com.android.support:appcompat-v7:26.0.0-beta1

I tried again after change the dependency. But nothing changed. Anko layout does not work in real phone.

import org.jetbrains.anko.*
import org.jetbrains.anko.sdk25.coroutines.onClick

class SignInActivityUI : AnkoComponent<SignInActivity> {
    override fun createView(ui: AnkoContext<SignInActivity>) = with(ui) {
        verticalLayout {
            val textView = textView()
            textView.text = "hello"
            val workingNo = editText {
                hintResource = R.string.working_no
            }
            val password = editText()
            password.hint = R.string.password.toString()
            button(R.string.title_activity_login) {
                onClick { ctx.toast("Hello")}
            }
        }
    }
}

The menu option "Anko Layout Preview" is greyed out for me in Android Studio 3.0 Canary 5 (Anko 0.10.1).

I have the same problem.

I have the same problem.

i have already install the plugin,and extend the AnkoComponent interface.but there is nothing show for me.event not show grey "anko layout preview".am i find wrong place?where you gays
find "anko layout preview" .my android studio is 3.0, canary 8.
hope solve this as quick as possible

The "Anko Layout Preview" option is not visible at all on the "Views -> Tool Windows" menu
in Android Studio 3.0 Beta 1 (MacOS Sierra)
I'm first putting the cursor in my "view declaration" (my AnkoComponent) implementation according to https://github.com/Kotlin/anko/wiki/Anko-Layouts#using-the-plugin

same on 3.0 canary9 as said @etsit

see the wiki https://github.com/Kotlin/anko/wiki/Anko-Layouts#using-the-plugin ; it's not yet support android studio 3.0+

Actually, it says "supported only in Android Studio 2.4+". The version 3.0 matches that requirement.

anyway, xml -> anko conversion works, so plugin works too, I just can't get the preview

Still no preview in AS 3.0 beta 4

come on, JetBrains, did Google told you that anko is not the right way and you discontinued the library ?

When did google talked about anko? Can someone give me the source of reference?

Still no preview in AS 3.0 beta 6

啥时候出正式版

Just Change the theme "AppTheme" to NoTitleBar

The only solution now is to rebuild your project to see any changes.

Fixed with c685e07256673f144d788c51865c6a42e13da120

I still see this error on Anko 0.10.4 with Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.14.13-1-ARCH

I'm including Anko in my module's build.gradle as

dependencies {
    ...
    implementation "org.jetbrains.anko:anko:$anko_version"
    ...
}

and my code seems to build okay, however the preview causes the java process running Android Studio to spike the CPU.

I just started a new project today using minSdk of 25 and I'm getting the same issue with the example verticalLayout.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nkanellopoulos picture nkanellopoulos  ·  4Comments

Anilugale picture Anilugale  ·  4Comments

HarryTylenol picture HarryTylenol  ·  4Comments

maomaobug picture maomaobug  ·  4Comments

telenc picture telenc  ·  3Comments