RobertoAllende
RobertoAllende

Reputation: 9508

Jetpack Compose: Could not set unknown property 'useIR'

I'm trying to compile AndroidX's Jetpack Compose following the instructions available at the README.md file with Android Studio 3.5 Beta 1 and I'm getting the following error from Gradle:

ERROR: Could not set unknown property 'useIR' for task ':ui-android-view:compileDebugKotlin' of type org.jetbrains.kotlin.gradle.tasks.KotlinCompile.

To get the code I followed the instructions described on section Checking Out the Code. Then, I imported the project on Android Studio 3.5 Beta 1 in a macOS Mojave 10.4 and when Gradle runs for the first time, I get the error.

Upvotes: 2

Views: 2891

Answers (3)

Tura
Tura

Reputation: 1326

Run ./studiow inside frameworks/support/ui, not inside frameworks/support

They use different version of Android Studio for each subprojects.

See support/buildSrc/studio_versions.properties and support/ui/studio_versions.properties. studiow uses these files to decide what version of Android Studio to use.

code chunk from studiow:

function runStudioMac() {
  appPath="$(findStudioMacAppPath)"
  echo "open ${appPath}"
  env STUDIO_PROPERTIES="${projectDir}/idea.properties" \
      STUDIO_VM_OPTIONS="${projectDir}/../development/studio/studio.vmoptions" \
      KOTLIN_OVERRIDE="1.3.30-compose-20190503" \
      open -a "${appPath}" "${projectDir}"
}

If you launch Android Studio directly from ui/studio/android-studio-idea-xx/Android studio.app, it will throw build error as the properties are bootstrapped only when you launch through ui/studiow.

+And do not use git pull directly from Android Studio. Use repo sync -j8 -c in the root directory to sync. I got some issues when I did that.

Upvotes: 2

Halil ÖZCAN
Halil ÖZCAN

Reputation: 109

In the Google I/O Romain Guy said JetpackCompose in development stage. Not even alpha. I faced this problem too because of wrong download.I think you too. I wrote an article "How You Can Install JetpackCompose" to your development machine step by step. Article Link

Upvotes: 1

Jim
Jim

Reputation: 2151

As of May 2019, Jetpack Compose is still in a pre-alpha, and uses a experimental versions of both Kotlin and AndroidStudio. It sounds like you downloaded a copy of AS 3.5 Beta, but you need to run it with the bundled version of studiow that supports jetpack compose, as described here: https://android.googlesource.com/platform/frameworks/support/#using-android-studio

Upvotes: 3

Related Questions