Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Compose version to latest stable version #956

Open
qamarelsafadi opened this issue Jun 18, 2023 · 1 comment
Open

Update Compose version to latest stable version #956

qamarelsafadi opened this issue Jun 18, 2023 · 1 comment

Comments

@qamarelsafadi
Copy link

No description provided.

@Fe1777
Copy link

Fe1777 commented Jun 6, 2024

Updating the version of Jetpack Compose in the Android Architecture Components samples requires modifying the project’s build.gradle files to reflect the latest stable versions of the Compose libraries. Here’s how you can make those changes:

Steps to Update Jetpack Compose Version


  1. Check the Latest Stable Version:

  2. Update Project-level build.gradle file:

    • Ensure that the Kotlin version and other configurations are compatible with the latest Compose version.
// build.gradle (Project-level)
buildscript {
    ext {
        compose_version = '1.4.0' // Update to the latest stable version
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.0' // Ensure this is up-to-date
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" // Ensure this matches the latest Compose version requirements
    }
}
  1. Update App-level build.gradle file:
    • Ensure that the compose dependency versions are updated.
// build.gradle (App-level)
plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.example.myapp"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    implementation "androidx.core:core-ktx:1.7.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.10"
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
    implementation "androidx.activity:activity-compose:1.4.0"
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
  1. Synchronize the Gradle Project:

    • After making these changes, sync your project with the Gradle files to apply the updates.
  2. Testing:

    • Ensure to test your application to verify that nothing is broken due to the library updates. If any APIs have changed, you might need to make necessary code adjustments.

Example Pull Request (PR) Update

If you’re submitting a pull request to update the Compose version, you might include the following message in your PR description:


PR Title: Update Compose version to latest stable version

Description:

This PR updates the Jetpack Compose version to the latest stable version [1.4.0]. Updates include changes to both the project-level and app-level build.gradle files to ensure compatibility with the new version. Detailed changes are as follows:

  • Updated ext.compose_version in project-level build.gradle.
  • Adjusted dependencies in app-level build.gradle to use the new Compose version.
  • Ensured kotlinCompilerExtensionVersion in composeOptions is consistent with the new Compose version.
  • Verified that all project dependencies are compatible with the updated Compose version.
  • Conducted testing to ensure application stability after the version update.

Apply these changes and test thoroughly to ensure that the project functions correctly with the latest Compose version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants