Compose Compiler Gradle প্লাগইন সেট আপ করুন

Gradle-এর জন্য, Compose সেট আপ এবং কনফিগার করতে Compose Compiler Gradle প্লাগইনটি ব্যবহার করুন।

গ্রেডল সংস্করণ ক্যাটালগ দিয়ে সেট আপ করুন

Compose Compiler Gradle প্লাগইনটি সেট আপ করুন:

  1. libs.versions.toml ফাইল থেকে Compose Compiler-এর সমস্ত উল্লেখ মুছে ফেলুন।
  2. versions এবং plugins সেকশনে নতুন ডিপেন্ডেন্সিটি যোগ করুন:
[versions]
kotlin = "2.3.10"

[plugins]
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

// Add this line
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
  1. প্রজেক্টের রুট build.gradle.kts ফাইলের plugins সেকশনে নিম্নলিখিতটি যোগ করুন।
plugins {
   // Existing plugins
   alias(libs.plugins.compose.compiler) apply false
}
  1. Compose ব্যবহার করে এমন প্রতিটি মডিউলে প্লাগইনটি প্রয়োগ করুন:
plugins {
   // Existing plugins
   alias(libs.plugins.compose.compiler)
}

প্রজেক্টটি এখন বিল্ড এবং কম্পাইল হওয়া উচিত, যদি এটি ডিফল্ট সেটআপ ব্যবহার করে থাকে। যদি কম্পোজ কম্পাইলারে কাস্টম অপশন কনফিগার করা থাকে, তাহলে পরবর্তী বিভাগটি অনুসরণ করুন।

Gradle সংস্করণ ক্যাটালগ ছাড়াই Compose কম্পাইলার সেট আপ করুন

যেসব মডিউলে Compose ব্যবহৃত হয়, সেগুলোর সাথে যুক্ত build.gradle.kts ফাইলে প্লাগইনটি যোগ করুন:

plugins {
    id("org.jetbrains.kotlin.plugin.compose") version "2.3.10" // this version matches your Kotlin version
}

আপনার টপ-লেভেল প্রজেক্টের build.gradle.kts ফাইলে ক্লাসপাথ যোগ করুন:

buildscript {
    dependencies {
        classpath("org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:2.3.10")
    }
}

কম্পোজ কম্পাইলার গ্রেডল প্লাগইনের সাথে কনফিগারেশন বিকল্পগুলি

Gradle প্লাগইন ব্যবহার করে Compose কম্পাইলার কনফিগার করতে, মডিউলের build.gradle.kts ফাইলের শীর্ষ স্তরে composeCompiler ব্লকটি যোগ করুন:

android {  }

composeCompiler {
    reportsDestination = layout.buildDirectory.dir("compose_compiler")
    stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}

উপলব্ধ অপশনগুলোর সম্পূর্ণ তালিকার জন্য ডকুমেন্টেশন দেখুন।

কম্পোজ নির্ভরতা সেট আপ করুন

সর্বদা Compose BOM-এর সর্বশেষ সংস্করণ ব্যবহার করুন: 2026.03.00

অ্যান্ড্রয়েড স্টুডিওতে কম্পোজ কার্যকারিতা সক্রিয় করতে, অ্যান্ড্রয়েড BuildFeatures ভিতরে compose ফ্ল্যাগটিকে true তে সেট করুন।

আপনার অ্যাপের build.gradle ফাইলে নিম্নলিখিত সংজ্ঞাটি যোগ করুন:

গ্রুভি

android {
    buildFeatures {
        compose true
    }
}

কোটলিন

android {
    buildFeatures {
        compose = true
    }
}

Compose BOM এবং Compose লাইব্রেরি নির্ভরতার উপসেটটি যোগ করুন:

গ্রুভি

dependencies {

    def composeBom = platform('androidx.compose:compose-bom:2026.03.00')
    implementation composeBom
    androidTestImplementation composeBom

    // Choose one of the following:
    // Material Design 3
    implementation 'androidx.compose.material3:material3'
    // or skip Material Design and build directly on top of foundational components
    implementation 'androidx.compose.foundation:foundation'
    // or only import the main APIs for the underlying toolkit systems,
    // such as input and measurement/layout
    implementation 'androidx.compose.ui:ui'

    // Android Studio Preview support
    implementation 'androidx.compose.ui:ui-tooling-preview'
    debugImplementation 'androidx.compose.ui:ui-tooling'

    // UI Tests
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'

    // Optional - Add window size utils
    implementation 'androidx.compose.material3.adaptive:adaptive'

    // Optional - Integration with activities
    implementation 'androidx.activity:activity-compose:1.13.0'
    // Optional - Integration with ViewModels
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0'
    // Optional - Integration with LiveData
    implementation 'androidx.compose.runtime:runtime-livedata'
    // Optional - Integration with RxJava
    implementation 'androidx.compose.runtime:runtime-rxjava2'

}

কোটলিন

dependencies {

    val composeBom = platform("androidx.compose:compose-bom:2026.03.00")
    implementation(composeBom)
    androidTestImplementation(composeBom)

    // Choose one of the following:
    // Material Design 3
    implementation("androidx.compose.material3:material3")
    // or skip Material Design and build directly on top of foundational components
    implementation("androidx.compose.foundation:foundation")
    // or only import the main APIs for the underlying toolkit systems,
    // such as input and measurement/layout
    implementation("androidx.compose.ui:ui")

    // Android Studio Preview support
    implementation("androidx.compose.ui:ui-tooling-preview")
    debugImplementation("androidx.compose.ui:ui-tooling")

    // UI Tests
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-test-manifest")

    // Optional - Add window size utils
    implementation("androidx.compose.material3.adaptive:adaptive")

    // Optional - Integration with activities
    implementation("androidx.activity:activity-compose:1.13.0")
    // Optional - Integration with ViewModels
    implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0")
    // Optional - Integration with LiveData
    implementation("androidx.compose.runtime:runtime-livedata")
    // Optional - Integration with RxJava
    implementation("androidx.compose.runtime:runtime-rxjava2")

}