Skip to content

Commit

Permalink
Merge pull request #2 from CMingTseng/main
Browse files Browse the repository at this point in the history
upgrade compose library & modify gradle let AS 4.0.X~ 4.2.X stable version support compose
  • Loading branch information
RugerMcCarthy authored Jun 30, 2021
2 parents 1a9008d + eadcad3 commit bed7fba
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 16 deletions.
50 changes: 41 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,36 @@ plugins {
id 'com.android.application'
id 'kotlin-android'
}
def android_builder_version = "4.0.1"

ext {
android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0])
android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1])
}

android {
this.rootProject.buildscript.configurations.classpath
.resolvedConfiguration
.firstLevelModuleDependencies.
each {
def name = it.name
if (name.contains('com.android.tools.build:gradle')) {
def moduleVersion = it.moduleVersion
if (moduleVersion.contains("-")) {
def alphaversionArray = moduleVersion.split("-")[0]
def versionArray = alphaversionArray.toString().split("\\.")
ext.android_builder_main_version = Integer.parseInt(versionArray[0])
ext.android_builder_mid_version = Integer.parseInt(versionArray[1])
} else {
version = moduleVersion
android_builder_version = moduleVersion
ext.android_builder_main_version = Integer.parseInt(android_builder_version.split("\\.")[0])
ext.android_builder_mid_version = Integer.parseInt(android_builder_version.split("\\.")[1])
}
}
}
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.androiddevchallenge"
Expand Down Expand Up @@ -38,11 +65,13 @@ android {

kotlinOptions {
jvmTarget = "1.8"
useIR = true
}

buildFeatures {
compose true

if (android_builder_main_version >= 5 || (android_builder_main_version == 4 && android_builder_mid_version >= 3)) {
compose true
}
// Disable unused AGP features
buildConfig false
aidl false
Expand All @@ -53,6 +82,7 @@ android {

composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}

packagingOptions {
Expand All @@ -65,18 +95,20 @@ android {

dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.activity:activity-compose:1.3.0-alpha04"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'

implementation "androidx.appcompat:appcompat:$compose_appcompat_version"
implementation "androidx.activity:activity-compose:$compose_activity_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
implementation "androidx.navigation:navigation-compose:1.0.0-alpha09"
implementation "dev.chrisbanes.accompanist:accompanist-insets:0.6.2"
implementation "androidx.navigation:navigation-compose:$compose_navigation_version"


testImplementation 'junit:junit:4.13.2'

androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigate

import androidx.navigation.compose.rememberNavController
import com.example.androiddevchallenge.R

Expand Down
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@
*/

buildscript {
ext.kotlin_version = '1.4.31'
ext.compose_version = '1.0.0-beta02'
ext.coroutines_version = '1.4.2'
ext {
android_gradle_plugin_version = '4.1.2'
kotlin_version = '1.5.10'
coroutines_version = '1.4.3'

compose_version = '1.0.0-beta08'//1.0.0-beta09 some low level android device get crash !! libart.so or libart.jar lost
compose_activity_version = '1.3.0-beta01'
compose_appcompat_version = '1.3.0'
compose_navigation_version = '2.4.0-alpha01'
}

repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.0-alpha09'
classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 24 18:05:51 CET 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rootProject.name = "AndroidDevChallenge"
//rootProject.name = "AndroidDevChallenge"
rootProject.name = "BloomCompose"
include ':app'

0 comments on commit bed7fba

Please sign in to comment.