Jetpack Compose: Error: Could not find or load main class Projects.androidx-master-dev.frameworks

Jetpack Compose: Error: Could not find or load main class Projects.androidx-master-dev.frameworks

我想尝试 Jetpack compose 并遵循此 README

cd path/to/checkout/frameworks/support/ui/
./studiow

按照指南,当我在 ui 目录中尝试 运行 ./studiow 脚本时,出现此错误。

Running ./gradlew studio
usage: dirname path
Error: Could not find or load main class Projects.androidx-master-dev.frameworks.support.......prebuilts.fullsdk-darwin.platform-tools.api.api-versions.xml
See also development/diagnose-build-failure for help with build failures in this project.

经过一段时间的尝试。

之前我已经将项目克隆到某个目录中。 androidx-master-devsomeDir someDir/androidx-master-dev.

里面

我不得不将它移回根目录 ~ 目录和脚本有效。

您现在不必克隆整个 ASOP。 Jetpack compose gradle 依赖项现已可用。你可以使用 as

def compose_version = '0.1.0-dev01'
kapt "androidx.compose:compose-compiler:$compose_version"
kapt "androidx.compose:compose-runtime:$compose_version"
implementation("androidx.ui:ui-core:$compose_version")
implementation("androidx.ui:ui-layout:$compose_version")
implementation("androidx.ui:ui-framework:$compose_version")
implementation("androidx.ui:ui-material:$compose_version")
implementation("androidx.ui:ui-foundation:$compose_version")
implementation("androidx.ui:ui-text:$compose_version")
implementation "org.jetbrains.kotlin:kotlin-reflect"