I made an Android Library. I upload it to Azure Artifact and pull it to my project from there.
I am making a service call with retrofit in the library. I'm using Moshi or Kotlinx-Serialization for Converter, but if I don't add these libraries to the Project where I use the library, I get errors like ClassNotFoundException. After adding, these errors go away, but the variables in the service models do not hold the data and remain null.
I think this is due to the 3rd party library (Moshi, KotlinX-Serialization, ...).
I found a way to include the 3rd party libraries I use in the library in the .aar package.
task copyLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
But when I run the task I got this error.
Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'implementation' should be resolved.
The .aar file path for my library consists of ->
Projects/MySDK-Android/MySDK/build/outputs/aar/MySDK-release.aar
I think if I include the 3rd party library I use for serialization (Moshi, KotlinX-Serilalization, Gson, ...) into my library, the problem will be solved.
Any help on how I can do it?
build.gradle
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id "kotlinx-serialization"
}
android {
compileSdk 31
defaultConfig {
minSdk 23
targetSdk 31
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'
}
kotlin {
// for strict mode
explicitApi()
// for warning mode
explicitApiWarning()
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
// Logger
implementation 'com.orhanobut:logger:2.2.0'
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
// KotlinX Serialization
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
}
task copyLibs(type: Copy) {
from configurations.customConfig
into "$project.rootDir/build/outputs/"
}
apply plugin: 'maven-publish'
apply plugin: "kotlinx-serialization"
publishing {
publications {
maven(MavenPublication) {
groupId 'com.my.mysdk-android'
artifactId 'mysdk-android'
version '1.0.0'
artifact("$projectDir/build/outputs/aar/MySDK-release.aar")
}
}
repositories {
maven {
url 'https://pkgs.dev.azure.com/......'
credentials {
username "MySDK.Android"
password accessToken
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Related
I'm unable to run the app because of this error:
Unable to find method ''void org.jetbrains.kotlin.gradle.tasks.KotlinCompile.<init>(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions, org.gradle.workers.WorkerExecutor, org.gradle.api.model.ObjectFactory)''
'void org.jetbrains.kotlin.gradle.tasks.KotlinCompile.<init>(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions, org.gradle.workers.WorkerExecutor, org.gradle.api.model.ObjectFactory)'
Here're my build.gradle files
build.gradle(:app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id("kotlin-kapt")
id("dagger.hilt.android.plugin")
id("com.google.devtools.ksp") version "1.8.0-1.0.8"
}
android {
namespace 'com.example.mediastoredao_23jan'
compileSdk 33
defaultConfig {
applicationId "com.example.mediastoredao_23jan"
minSdk 24
targetSdk 33
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'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
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.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation("com.google.dagger:hilt-android:2.44")
kapt("com.google.dagger:hilt-android-compiler:2.44")
implementation ('com.jakewharton.timber:timber:5.0.1')
def room_version = "2.5.0"
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
// To use Kotlin Symbol Processing (KSP)
ksp("androidx.room:room-compiler:$room_version")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")
// lifecycle
def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
}
// Allow references to generated code
kapt {
correctErrorTypes = true
}
build.gradle Module
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.21' apply false
id("com.google.dagger.hilt.android") version "2.44" apply false
}
Additional Info
Sync Project with Gradle Files can run without issue, but when running the app will encounter the mentioned error.
I've tried all of the provided solutions and hit the File > Invalidate Caches/Restart... option.
Build Output Image
The image shows the Build Output. This is Android Studio IDE 2022.1, coded in Kotlin
So I use SwitchMaterial in one layout:
<com.google.android.material.switchmaterial.SwitchMaterial...
And Firebase Crashlytics spams me with the following errors for many users
Fatal Exception: java.lang.RuntimeException Unable to start activity
ComponentInfo{...}: android.view.InflateException: Binary XML file
line #324: Binary XML file line #324: Error inflating class
com.google.android.material.switchmaterial.SwitchMaterial
Caused by android.content.res.Resources$NotFoundException File
res/drawable/abc_switch_thumb_material.xml from drawable resource ID
#0x7f080047
App theme:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">...
Material dep:
implementation "com.google.android.material:material:1.6.1"
What does it mean?
Update
I tried to use Switch from AndroidX AppCompat library instead and still the same issue with drawable:
Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{****.ui.MainActivity}: android.view.InflateException: Binary XML file line #324: Binary XML file line #324: Error inflating class androidx.appcompat.widget.SwitchCompat
Caused by android.content.res.Resources$NotFoundException Drawable ***:drawable/abc_switch_thumb_material with resource ID #0x7f080047
This is so weird, it works fine for my smartphones though but it's effected 22 my users already
Yes, I have both the following options enabled for release builds
minifyEnabled true
shrinkResources true
But it worked fine all the time for different apps and I never had to add anything to a proguard file to keep drawable of some third party libraries (especially Google libraries) - abc_switch_thumb_material
Update 2
I just tried to download APK generated by Google Play Console from my AAB file
I checked apk\res\drawable\ and found that drawable is available
This is magic...
But this generated APK is universal and Google Play Consoles generates different APK based on type of device and its Android version, so what happens in this case I don't know
Update 3
I will try to use just Switch even if Android Studio shows the following warning:
Use SwitchCompat from AppCompat or SwitchMaterial from Material
library
But at least I hope my app will stop getting crashed for some users because of it
p.s. devices for which the error happens (Firebase Crashlytics):
My build.gradle files of that app (if it's helpful in anyway and mb there are some conflicts between libraries)
Project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = "1.7.10"
nav_version = "2.5.1"
hilt_version = "2.43.2"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:4.3.13"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" // for DataStore
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App module build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
id "kotlin-parcelize"
id "dagger.hilt.android.plugin"
id "androidx.navigation.safeargs.kotlin"
id "kotlinx-serialization" // for DataStore
}
android {
compileSdkVersion 32
defaultConfig {
applicationId ***
minSdkVersion 21
targetSdkVersion 32
multiDexEnabled true
versionCode 18
versionName "1.0.15"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
manifestPlaceholders = [crashlyticsEnabled: false]
signingConfig signingConfigs.release
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
manifestPlaceholders = [crashlyticsEnabled: true]
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}
buildFeatures {
dataBinding = true
}
}
dependencies {
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.appcompat:appcompat:1.5.0"
implementation "androidx.activity:activity-ktx:1.5.1"
implementation "androidx.fragment:fragment-ktx:1.5.2"
implementation "androidx.multidex:multidex:2.0.1"
implementation "com.google.android.material:material:1.6.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "com.jakewharton.timber:timber:5.0.1"
implementation platform("com.google.firebase:firebase-bom:30.3.2")
implementation "com.google.firebase:firebase-analytics"
implementation "com.google.firebase:firebase-crashlytics"
implementation "com.google.firebase:firebase-ads:21.1.0"
implementation "com.google.android.ump:user-messaging-platform:2.0.0"
implementation "com.android.billingclient:billing-ktx:5.0.0"
def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
// OkHttp
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
// Retrofit
def retrofit = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
// Glide
def glide_version = "4.13.2"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
// Pagination
implementation "androidx.paging:paging-runtime-ktx:3.1.1"
// Datastore
implementation "androidx.datastore:datastore:1.0.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.4.0"
implementation "org.jsoup:jsoup:1.15.2"
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
the crashes stopped when i switched to using <Switch>
both <SwitchCompat> and <SwitchMaterial> caused crashes in production
I am working with Android Studio, and I am trying to use google material library
I am getting the following error (Android resource linking failed):
ERROR:AAPT: C:\Users\ANDRES\Desktop\cursillo_android\TipTime2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:3: error: resource android:color/system_neutral1_1000 not found.
Mi grade files are:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
compileSdkVersion 30
defaultConfig {
applicationId "com.example.tiptime2"
minSdk 24
targetSdk 30
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'
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I would like to share a picture of the error with you:
Thank you
When your targetSdk is below 31 then the support library associated
with material resources will be in conflict with your build configuration.
During the build, gradle will use a task to check all support .aar libraries
metadata, where build target compatibility is set; in the case of
com.google.android.material:material:1.5.0-alpha05' the target compatibility
is set above 30 (may be 31, or even higher);
Remedy is this:
So go to an earlier material support library from
here https://mvnrepository.com/artifact/com.google.android.material/material
to use an earlier support version of the material support class;
I'm trying to compile an Android app and the Gradle build is failing. The project is in Java but does have Room code as well, which I believe is where the issue is arising from. The build is unable to find the Guava repository at www.google.com:guava:23.6-Android even though this file has been added as a dependency.
The initial result build fail looks like this:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :App
The project-level build file:
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The app level build file contains the following:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.nathan.digipizza"
minSdkVersion 19
targetSdkVersion 31
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
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation 'com.google.guava:guava:26.3-android'
def room_version = "2.3.0"
implementation 'androidx.appcompat:appcompat:1.4.0-rc01'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-compiler:2.4.0'
implementation 'androidx.room:room-runtime:2.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
annotationProcessor 'androidx.room:room-compiler:2.3.0'
}
It is difficult to post the entire dependency tree since I'm still unable to post screen images. But the repository in question, com.google.guava:guava:23.6-android, is not listed as a dependency for any other files, and its entry in the tree for the release variant reflects this fact as it is situated furthest left on the tree as follows:
+--- com.google.guava:guava:23.6-android FAILED
This repository only appears once in the dependency tree, furthermost to the left.
The com.google.guava:guava:23.6-android repository has an updated version to 30.1-android. I did update the version, but the error remains and everything is the same as above except version 30.1-android replaces version 23.6-android.
I need to figure out how to resolve the build error, which I'll post here again for ease of use:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :app
I don't understand how the build is failing to see this repository when it has been added as a dependency, and there doesn't appear to be any complications apparent by analyzing the dependency tree.
Lately I have been strugling trying to make jetpack compose run... I have follow all the example codes, downloaded canary and all, but the 1.4.0 plugin is not working for me and I get compile problems
These are my gradle files
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.0"
ext.compose_version = '1.0.0-alpha01'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0-alpha08"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.jetexample"
minSdkVersion 21
targetSdkVersion 30
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'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion kotlin_version
kotlinCompilerVersion compose_version
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
//Fundamental building blocks of Compose's programming model and state management, and core runtime for the Compose Compiler Plugin to target.
implementation "androidx.compose.runtime:runtime:$compose_version"
//Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input.
implementation "androidx.compose.ui:ui:$compose_version"
//Build Jetpack Compose UIs with ready to use Material Design Components. This is the higher level entry point of Compose, designed to provide components that match those described at www.material.io.
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
//Write Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces.
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
//Build animations in their Jetpack Compose applications to enrich the user experience.
implementation "androidx.compose.animation:animation:$compose_version"
//In charge of annotators like #Preview and tooling for render views
implementation "androidx.ui:ui-tooling:$compose_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
The error I get is this one
Could not resolve compiler classpath. Check if Kotlin Gradle plugin repository is configured in project ':app'.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugAndroidTestKotlin'.
> Could not resolve all files for configuration ':app:kotlinCompilerClasspath'.
> Could not find org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-alpha01.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.0.0-alpha01/kotlin-compiler-embeddable-1.0.0-alpha01.pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.0.0-alpha01/kotlin-compiler-embeddable-1.0.0-alpha01.pom
Required by:
project :app
> Could not find org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-alpha01.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.0.0-alpha01/kotlin-compiler-embeddable-1.0.0-alpha01.pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.0.0-alpha01/kotlin-compiler-embeddable-1.0.0-alpha01.pom
Required by:
project :app
I have tried with this version, I have followed the documentation, the jet news example and everything but I cant compile the project, what I'm doing wrong ?
I have missmatched the compileOptions
composeOptions {
kotlinCompilerExtensionVersion kotlin_version
kotlinCompilerVersion compose_version
}
should be
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}