1 year ago

#351276

test-img

AdrienM

Accompanist implementation causes rendering error Compose

Implementing Accompanist flowlayout causes rendering problems :

implementation "com.google.accompanist:accompanist-flowlayout:0.24.5-alpha" https://google.github.io/accompanist/flowlayout/

Here are my build gradles :

app

    plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "com.adrienmandroid.composecv"
        minSdk 21
        targetSdk 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    flavorDimensions 'application_owner'
    productFlavors {
        AdrienOwner {
            dimension 'application_owner'
            applicationId 'com.adrienmandroid.adrrienowner'
        }
        JeromeOwner {
            dimension 'application_owner'
            applicationId 'com.adrienmandroid.jeromeowner'
        }
    }
    sourceSets {
        AdrienOwner {
            res.srcDirs = ['src/adrien/res']
        }
        JeromeOwner {
            res.srcDirs = ['src/jerome/res']
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
    implementation 'androidx.activity:activity-compose:1.3.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    def nav_version = "2.4.1"
    implementation("androidx.navigation:navigation-compose:$nav_version")
    implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02"
    implementation "com.google.accompanist:accompanist-flowlayout:0.24.5-alpha"
}

root

buildscript {
    ext {
        compose_version = '1.2.0-alpha06'
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.1' apply false
    id 'com.android.library' version '7.1.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I tried looking at the dependency tree to see if anything was missing, but I have put everything up to date. Does anyone knows where that could come from ?

Edit : stacktrace error Rendering sandbox error

Property access not allowed during rendering
    at com.android.tools.idea.rendering.RenderSecurityException.create(RenderSecurityException.java:52)
    at com.android.tools.idea.rendering.RenderSecurityManager.checkPropertiesAccess(RenderSecurityManager.java:327)
    at java.base/java.lang.System.getProperties(System.java:718)
    at com.intellij.idea.IdeaLogger.logErrorHeader(IdeaLogger.java:110)
    at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:104)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:187)
    at com.intellij.ide.plugins.StartupAbortedException.processException(StartupAbortedException.java:30)
    at com.intellij.ide.plugins.MainRunner$1.uncaughtException(MainRunner.java:35)
    at _layoutlib_._internal_.kotlinx.coroutines.CoroutineExceptionHandlerImplKt.handleCoroutineExceptionImpl(CoroutineExceptionHandlerImpl.kt:45)
    at _layoutlib_._internal_.kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:39)
    at _layoutlib_._internal_.kotlinx.coroutines.StandaloneCoroutine.handleJobException(Builders.common.kt:192)
    at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:229)
    at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906)
    at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863)
    at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828)
    at _layoutlib_._internal_.kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
    at _layoutlib_._internal_.kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:193)
    at _layoutlib_._internal_.kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
    at _layoutlib_._internal_.kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
    at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
    at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt.launch(Unknown Source)
    at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
    at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
    at androidx.compose.ui.platform.WindowRecomposer_androidKt$createLifecycleAwareWindowRecomposer$2.onStateChanged(WindowRecomposer.android.kt:375)
    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
    at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:364)
    at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:322)
    at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:166)
    at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:222)
    at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:297)
    at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:240)
    at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:247)
    at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:279)
    at android.view.View.dispatchAttachedToWindow(View.java:20753)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
    at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:57)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:368)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
    at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:736)
    at com.android.tools.idea.rendering.RenderTask.lambda$inflate$7(RenderTask.java:892)
    at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:187)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

android

android-jetpack-compose

jetpack-compose-accompanist

0 Answers

Your Answer

Accepted video resources