https://kotlinlang.org logo
#splitties
Title
# splitties
k

kluck

05/06/2019, 7:27 AM
Hello, I'm trying to get Splitties Ui Preview to work, but even after a full build, I get an issue in my preview:
Copy code
Failed to instantiate one or more classes
The following classes could not be instantiated:
- splitties.views.dsl.idepreview.UiPreView (Open Class, Show Exception, Clear Cache)
Here's my preview file `src/debug/res/layout/main_preview.xml`:
Copy code
<splitties.views.dsl.idepreview.UiPreView
    xmlns:android="<http://schemas.android.com/apk/res/android>"
    xmlns:app="<http://schemas.android.com/apk/res-auto>"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:splitties_class_package_name_relative=".MainUi"/>
The actual Ui file:
Copy code
class MainUi(override val ctx: Context) : Ui {
    override val root = coordinatorLayout {
        fitsSystemWindows = true
        add(appBarLayout(theme = R.style.AppTheme_AppBarOverlay) {
            add(toolbar {
                popupTheme = R.style.AppTheme_PopupOverlay
                (ctx as? AppCompatActivity)?.setSupportActionBar(this)
            }, defaultLParams())
        }, appBarLParams())
        add(frameLayout(id = R.id.container) {}, contentScrollingWithAppBarLParams())
    }
}
In my dependencies, I have
debugImplementation("com.louiscad.splitties:splitties-views-dsl-ide-preview:$splittiesVersion")
Is there something I might have missed?
l

louiscad

05/06/2019, 11:58 AM
Hello @kluck What do you see when you click "Show Exception"?
Not sure why you posted in the channel too
k

kluck

05/06/2019, 12:59 PM
Oh, I thought it might be useful for other people too, so I ticked the box ^^
l

louiscad

05/06/2019, 1:01 PM
People interested will open the thread as this channel is not busy. Can you try adding the appCtx dependency? It seems I forgot to add the dependency
k

kluck

05/06/2019, 1:15 PM
With the added dependency, it works. But with the
splitties_class_fully_qualified_name
and not the
splitties_class_package_name_relative
.
thanks