【问题标题】:Unresolved reference: compose in RelayBaseComposable未解决的参考:在 RelayBaseComposable 中撰写
【发布时间】:2023-02-04 13:30:43
【问题描述】:

我尝试使用 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

}

安卓 { 编译SDK 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'

}

【问题讨论】:

    标签: android-studio kotlin gradle import figma


    【解决方案1】:

    Unresolved reference: compose in RelayBaseComposable -- 此错误消息表示代码正试图从 RelayBaseComposable 类访问 compose 函数,但找不到此类或函数。

    好像是中继到 Figma工具需要中继库将作为依赖项添加到您的 build.gradle 文件中,但未在您提供的代码的依赖项块中指定。

    你能试试这个吗?将此添加到您的依赖项块:

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

    这应该导入中继库,从而解析对错误消息中提到的 compose 函数的引用。

    【讨论】:

      猜你喜欢
      • 2021-12-29
      • 1970-01-01
      • 2021-11-02
      • 2019-04-05
      • 1970-01-01
      • 2021-08-17
      • 2016-12-14
      • 2020-05-27
      • 2019-11-16
      相关资源
      最近更新 更多