Skip to content

Commit ac8dd73

Browse files
jkasten2jinliu9508
authored andcommitted
Gradle 8 / AGP 8 requires Java / Kotlin module
The top level gradle project needs a Java / Kotlin module, otherwise it skipped publishing an .aar file. While there is no code, projects consuming this SDK look for it. * Maybe we can omit the .aar on in the future for this top level project but keeping it working the same for now. Built SDK with Java 17 and tested publishing with a staging build with: * Java 11 * Gradle 7.3.3 * APG 7.2.2 * Android 5 & 14 Emulator WARNING: It is still recommended building with Java 17 instead of 21 when publishing, as those on older version of R8 will get this build error: * Cannot invoke "String.length()" because "<parameter1>" is null * See https://stackoverflow.com/q/77788162
1 parent a5cb91c commit ac8dd73

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

OneSignalSDK/onesignal/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
plugins {
22
id 'com.android.library'
3+
// There isn't Kotlin or Java code in this top-level project,
4+
// however consumers look for an .aar file, which this causes it
5+
// to be created.
6+
id 'kotlin-android'
37
}
48

59
android {
@@ -25,6 +29,8 @@ android {
2529
targetCompatibility JavaVersion.VERSION_1_8
2630
}
2731
namespace 'com.onesignal'
32+
33+
kotlinOptions.freeCompilerArgs += ['-module-name', namespace]
2834
}
2935

3036
ext {

0 commit comments

Comments
 (0)