Skip to content

Commit 3ba6768

Browse files
committed
Update to Android Gradle plugin version 9.0.0 (closes #1096)
1 parent b3184eb commit 3ba6768

File tree

24 files changed

+128
-50
lines changed

24 files changed

+128
-50
lines changed

demo/app/build.gradle.kts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id("com.android.application")
3-
id("org.jetbrains.kotlin.android")
43
id("com.chaquo.python")
54
}
65

@@ -66,17 +65,14 @@ android {
6665
sourceCompatibility = JavaVersion.VERSION_1_8
6766
targetCompatibility = JavaVersion.VERSION_1_8
6867
}
69-
kotlinOptions {
70-
jvmTarget = "1.8"
71-
}
7268

7369
// For testing with minifyEnabled (see release/README.md).
7470
buildTypes {
7571
create("releaseMinify") {
7672
initWith(getByName("release"))
7773
isMinifyEnabled = true
7874
proguardFiles(
79-
getDefaultProguardFile("proguard-android.txt"),
75+
getDefaultProguardFile("proguard-android-optimize.txt"),
8076
"proguard-rules.pro"
8177
)
8278
}
@@ -136,8 +132,9 @@ for (path in listOf(
136132
"src/utils" // Files shared with pkgtest app
137133
)) {
138134
android.sourceSets.getByName("main") {
139-
java { srcDir("$path/java") }
140-
res { srcDir("$path/res") }
135+
java { directories.add("$path/java") }
136+
kotlin { directories.add("$path/java") }
137+
res { directories.add("$path/res") }
141138
}
142139
chaquopy.sourceSets.getByName("main") {
143140
srcDir("$path/python")

demo/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Top-level build file where you can add configuration options common to all
22
// sub-projects/modules.
33
plugins {
4-
id("com.android.application") version "8.13.2" apply false
5-
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
4+
id("com.android.application") version "9.0.0" apply false
65

76
// com.chaquo.python is declared in settings.gradle.kts, because dynamic versions
87
// are not possible here. See

demo/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip

product/gradle-plugin/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ also be given here.
5757
the Chaquopy development version and the new AGP version.
5858

5959
* Open the "product" project in the new Android Studio version, then:
60-
* Consider updating the Gradle version, but first see the note in
61-
product/gradle/wrapper/gradle-wrapper.properties.
6260
* Sync the project.
6361
* Test it by running the `publish` task.
6462
* Update the demo and pkgtest apps as follows. Leave the public apps alone for now: they
6563
will be dealt with during the next release (see release/README.md).
66-
* In Android Studio, run Tools > AGP Upgrade Assistant.
64+
* In Android Studio, run Tools > AGP Upgrade Assistant. If this applies any
65+
compatibility settings which are no longer the default, try to use the recommended
66+
settings instead.
6767
* Apply any other updates from the "base" directory above.
6868
* Test the app.
6969
* Close all projects to make sure .idea files are written.

product/gradle-plugin/src/test/integration/data/ChaquopyPlugin/apply_buildscript/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
22
repositories {
33
google()
4-
jcenter()
4+
mavenCentral()
55
maven { url $/{{ chaquopyRepository }}/$ }
66
}
77
dependencies {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
allprojects {
22
repositories {
33
google()
4-
jcenter()
4+
mavenCentral()
55
}
66
}

product/gradle-plugin/src/test/integration/data/JavaLib/dynamic_feature/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ apply plugin: 'com.chaquo.python'
33

44
android {
55
namespace "com.chaquo.python.test"
6-
compileSdk 28
6+
compileSdk 35
77
defaultConfig {
88
applicationId "com.chaquo.python.test"
99
minSdk 24
10-
targetSdk 28
10+
targetSdk 35
1111
versionCode 1
1212
versionName "0.0.1"
1313
ndk {

product/gradle-plugin/src/test/integration/data/JavaLib/dynamic_feature/dynamicfeature/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apply plugin: 'com.android.dynamic-feature'
22

33
android {
44
namespace "com.chaquo.python.dynamicfeature"
5-
compileSdk 28
5+
compileSdk 35
66

77
defaultConfig {
88
applicationId "com.example.dynamicfeature"
99
minSdk 24
10-
targetSdk 28
10+
targetSdk 35
1111
versionCode 1
1212
versionName "1.0"
1313
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id("com.android.application") version "{{ agpVersion }}" apply false
4+
id("com.android.library") version "{{ agpVersion }}" apply false
5+
id("com.android.dynamic-feature") version "{{ agpVersion }}" apply false
6+
id("com.chaquo.python") version "{{ chaquopyVersion }}" apply false
7+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
chaquopy.javaVersion=21
2+
chaquopy.agpVersion=9.0.0
3+
4+
# Avoid including the Kotlin standard library in the app.
5+
android.builtInKotlin=false
6+
7+
# Gradle Daemon will terminate itself after specified number of idle milliseconds.
8+
# Default is 10800000 (3 hours), but that can overload the machine when running
9+
# integration tests on many versions. Reduce to 30 minutes.
10+
org.gradle.daemon.idletimeout=1800000
11+
12+
# Default settings generated by the new project wizard:
13+
14+
# Specifies the JVM arguments used for the daemon process.
15+
# The setting is particularly useful for tweaking memory settings.
16+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
17+
# When configured, Gradle will run in incubating parallel mode.
18+
# This option should only be used with decoupled projects. For more details, visit
19+
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
20+
# org.gradle.parallel=true
21+
# AndroidX package structure to make it clearer which packages are bundled with the
22+
# Android operating system, and which are packaged with your app's APK
23+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
24+
android.useAndroidX=true
25+
# Kotlin code style for this project: "official" or "obsolete":
26+
kotlin.code.style=official
27+
# Enables namespacing of each library's R class so that its R class includes only the
28+
# resources declared in the library itself and none from the library's dependencies,
29+
# thereby reducing the size of the R class for that library
30+
android.nonTransitiveRClass=true

0 commit comments

Comments
 (0)