Skip to content

Unity 6 support #194

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CTExample/Assets/Plugins/Android/baseProjectTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'com.android.application' version '8.7.2' apply false
id 'com.android.library' version '8.7.2' apply false
id 'com.google.gms.google-services' version '4.4.2' apply false
**BUILD_SCRIPT_DEPS**
}
Expand Down
16 changes: 10 additions & 6 deletions CTExample/Assets/Plugins/Android/launcherTemplate.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
apply from: 'setupSymbols.gradle'
apply from: '../shared/keepUnitySymbols.gradle'
Comment on lines +2 to +3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure auxiliary Gradle scripts are included in the repo

setupSymbols.gradle and ../shared/keepUnitySymbols.gradle are now applied but are not part of Unity’s default template. Missing files will halt the Gradle sync.

If they’re generated at build time, document the generation step; otherwise commit them.

🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/launcherTemplate.gradle at lines 2 to 3, the
scripts setupSymbols.gradle and ../shared/keepUnitySymbols.gradle are applied
but not included in the repository. To fix this, either commit these Gradle
script files to the repo if they are static, or if they are generated during the
build process, add clear documentation in the project explaining how and when
these files are generated to ensure Gradle sync does not fail.

apply plugin: 'com.google.gms.google-services'

dependencies {
Expand All @@ -8,10 +10,11 @@ dependencies {
}

android {
ndkVersion "**NDKVERSION**"
namespace "**NAMESPACE**"
ndkPath "**NDKPATH**"

compileSdkVersion **APIVERSION**
compileSdk **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'

compileOptions {
Expand All @@ -20,22 +23,23 @@ android {
}

defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
minSdk **MINSDK**
targetSdk **TARGETSDK**
applicationId '**APPLICATIONID**'
ndk {
debugSymbolLevel **DEBUGSYMBOLLEVEL**
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}

aaptOptions {
androidResources {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**

lintOptions {
lint {
abortOnError false
}

Expand All @@ -49,7 +53,7 @@ android {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
}**PACKAGING****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
Expand Down
32 changes: 18 additions & 14 deletions CTExample/Assets/Plugins/Android/mainTemplate.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.library'
apply from: '../shared/keepUnitySymbols.gradle'
**APPLY_PLUGINS**

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// MANDATORY for CleverTap App Inbox
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'

// Optional ExoPlayer Libraries for CleverTap Audio/Video Inbox Messages.
Expand All @@ -17,20 +18,21 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer-ui:2.19.1"

// Optional CleverTap push templates
implementation 'com.clevertap.android:push-templates:1.2.4'
implementation 'com.clevertap.android:push-templates:1.4.0'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Confirm transitive FCM version pulled by push-templates:1.4.0

com.clevertap.android:push-templates:1.4.0 now transitively drags in Firebase BoM 32.x which in turn requires Play-services 22.x.
Unity projects that still ship their own (older) Firebase packages will hit DEX/classpath clashes.

Pro-tip: add an explicit Firebase BoM line here so that the version is deterministic, or document the expected range.

🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle at line 21, the
dependency 'com.clevertap.android:push-templates:1.4.0' transitively includes
Firebase BoM 32.x, which may conflict with older Firebase versions in Unity
projects. To fix this, explicitly add a Firebase BoM dependency with a specific
version in the gradle file to ensure a deterministic Firebase version and avoid
classpath clashes. Alternatively, document the expected Firebase version range
clearly.


// Optional AndroidX Media3 Libraries for CleverTap Audio/Video Inbox Messages.
// Audio/Video messages will be dropped without these dependencies
// implementation "androidx.media3:media3-exoplayer:1.1.1"
// implementation "androidx.media3:media3-exoplayer-hls:1.1.1"
// implementation "androidx.media3:media3-ui:1.1.1"
// implementation "androidx.media3:media3-exoplayer:1.4.0"
// implementation "androidx.media3:media3-exoplayer-hls:1.4.0"
// implementation "androidx.media3:media3-ui:1.4.0"
**DEPS**}

android {
namespace "com.unity3d.player"
ndkVersion "**NDKVERSION**"
namespace "com.unity3d.player"
ndkPath "**NDKPATH**"

compileSdkVersion **APIVERSION**
compileSdk **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'

compileOptions {
Expand All @@ -39,24 +41,26 @@ android {
}

defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
**DEFAULT_CONFIG_SETUP**
minSdk **MINSDK**
targetSdk **TARGETSDK**
ndk {
debugSymbolLevel **DEBUGSYMBOLLEVEL**
abiFilters **ABIFILTERS**
}
Comment on lines +44 to 50
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

debugSymbolLevel available only with NDK-sidestripper enabled

debugSymbolLevel requires AGP 8 and the NDK side-stripper feature.
If the placeholder expands to an empty string it will generate invalid DSL (debugSymbolLevel ).
Guard the insertion (e.g., via $if(DEBUGSYMBOLLEVEL)$) or default to debugSymbolLevel 'FULL'.

🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle around lines 44 to 50,
the debugSymbolLevel property is inserted unconditionally, which can cause
invalid DSL if the placeholder is empty. To fix this, wrap the debugSymbolLevel
line with a conditional check to only include it if DEBUGSYMBOLLEVEL is set, or
provide a default value like 'FULL' to ensure valid syntax when the placeholder
is empty.

versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}

lintOptions {
lint {
abortOnError false
}

aaptOptions {
androidResources {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**
}**PACKAGING**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Placeholder rename may break the post-processor

**PACKAGING_OPTIONS****PACKAGING**

Search the Unity post-build replacer scripts (GradleTemplateParser.cs, etc.) – they probably still substitute PACKAGING_OPTIONS.
A missing replacement will leave the literal **PACKAGING** in the generated build.gradle and break the build.

🤖 Prompt for AI Agents
In CTExample/Assets/Plugins/Android/mainTemplate.gradle at line 63, the
placeholder was renamed from **PACKAGING_OPTIONS** to **PACKAGING**, but Unity's
post-build scripts like GradleTemplateParser.cs likely still expect
**PACKAGING_OPTIONS**. Revert the placeholder name back to **PACKAGING_OPTIONS**
to ensure the post-processor correctly replaces it and prevents build failures.

}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
Expand Down
19 changes: 10 additions & 9 deletions CTExample/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"dependencies": {
"com.clevertap.clevertap-sdk-unity": "file:../../CleverTap",
"com.unity.collab-proxy": "2.5.2",
"com.unity.collab-proxy": "2.8.1",
"com.unity.feature.2d": "2.0.1",
"com.unity.ide.rider": "3.0.31",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.mobile.notifications": "2.3.2",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.9",
"com.unity.timeline": "1.7.6",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.9.4",
"com.unity.ide.rider": "3.0.36",
"com.unity.ide.visualstudio": "2.0.23",
"com.unity.mobile.notifications": "2.4.0",
"com.unity.multiplayer.center": "1.0.0",
"com.unity.test-framework": "1.5.1",
"com.unity.timeline": "1.8.7",
"com.unity.ugui": "2.0.0",
"com.unity.visualscripting": "1.9.6",
"com.yasirkula.ingamedebugconsole": "https://github.com/yasirkula/UnityIngameDebugConsole.git",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
Loading