簡體   English   中英

未解決的參考:在 RelayBaseComposable 中撰寫

[英]Unresolved reference: compose in RelayBaseComposable

我嘗試使用 Relay to Figma 工具將 figma 設計導入 Android studio,但在我修復 HOME_JAVA 問題后它給了我這個錯誤,它告訴我 HOME_JAVA 無效目錄。

這是我的代碼:

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id'com.google.relay'                 //added to figma

}

android { compileSdk 32

sourceSets {
    main {
        assets {
            srcDir('src/main/ui-packages')          //added to figma
        }
    }
}


defaultConfig {
    applicationId "com.example.figma_layout"
    minSdk 21
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

}

依賴關系{

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

}

Unresolved reference: compose in RelayBaseComposable ——此錯誤消息表明代碼正在嘗試從RelayBaseComposable class 訪問compose function,但無法找到此 class 或 function。

Relay to Figma工具似乎需要將Relay 庫作為依賴項添加到您的build.gradle文件中,但它未在您提供的代碼的依賴項塊中指定。

你能試試這個嗎? 將此添加到您的依賴項塊:

implementation 'com.google.relay:relay:0.1.0'

這應該導入Relay library ,從而解析對錯誤消息中提到的compose function 的引用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM