Skip to content

[Bug]: Incorrect OneSignalConfig.androidlib/build.gradle Fails to make Android build on Unity 6 #775

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

Closed
1 task done
IvanMurzak opened this issue Oct 16, 2024 · 6 comments

Comments

@IvanMurzak
Copy link

IvanMurzak commented Oct 16, 2024

What happened?

Android build fails in Unity 6

Steps to reproduce?

1. Create a project with Unity 6
2. Install OneSignal Unity SDK for Android version 5.1.9
3. Run all steps via `Window/OneSignal SDK Setup`
4. Press `Build` for Android platform

What did you expect to happen?

To have android build generated

OneSignal iOS SDK version

5.1.9

iOS version

17

Specific iOS version

- there is no iOS, just Android

Relevant log output

Incorrect package="com.onesignal.onesignalsdk" found in source AndroidManifest.xml: C:\Projects\Mirrorscape\MirrorscapeApp-Unity6\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\OneSignalConfig.androidlib\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.onesignal.onesignalsdk" from the source AndroidManifest.xml: C:\Projects\Mirrorscape\MirrorscapeApp-Unity6\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\OneSignalConfig.androidlib\AndroidManifest.xml.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':unityLibrary:OneSignalConfig.androidlib:processReleaseManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
   > Incorrect package="com.onesignal.onesignalsdk" found in source AndroidManifest.xml: C:\Projects\Mirrorscape\MirrorscapeApp-Unity6\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\OneSignalConfig.androidlib\AndroidManifest.xml.
     Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
     Recommendation: remove package="com.onesignal.onesignalsdk" from the source AndroidManifest.xml: C:\Projects\Mirrorscape\MirrorscapeApp-Unity6\Library\Bee\Android\Prj\IL2CPP\Gradle\unityLibrary\OneSignalConfig.androidlib\AndroidManifest.xml.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 5s

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@IvanMurzak
Copy link
Author

That is the mistake in OneSignal installer, that adds OneSignalConfig.androidlib/build.gradle file. It forgot to add the line into the file.

namespace 'com.onesignal.onesignalsdk'

@IvanMurzak
Copy link
Author

IvanMurzak commented Oct 16, 2024

There is fixed file, please update it in the OneSignal Unity SDK

apply plugin: 'com.android.library'

android {
    namespace 'com.onesignal.onesignalsdk'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
        }
    }

    def unityLib = project(':unityLibrary').extensions.getByName('android')

    defaultConfig {
        consumerProguardFiles "consumer-proguard.pro"
        minSdkVersion unityLib.defaultConfig.minSdkVersion.mApiLevel
        targetSdkVersion unityLib.defaultConfig.targetSdkVersion.mApiLevel
    }

    compileSdkVersion unityLib.compileSdkVersion
    buildToolsVersion unityLib.buildToolsVersion

    lintOptions {
        abortOnError false
    }
}

@nan-li nan-li transferred this issue from OneSignal/OneSignal-iOS-SDK Jan 8, 2025
@Dummiesman
Copy link

Dummiesman commented Jan 18, 2025

Imagine you're showing a project manager how great OneSignal works, except the project manager wants Unity 6.

Where the included dependency resolver fails due to too new OpenJDK used by Unity
and then the build fails because of this

I don't have to imagine :)
Shocking that this is still broken.

MARCH 2025: no update to this, no updates from onesignal
You've lost a customer

@JasonZingPerformance
Copy link

JasonZingPerformance commented Feb 24, 2025

OneSignal Unity SDK v5.1.12 still has this issue with a Long Term Support version (non Preview) of Unity 6 - Unity 6000.0.38f1

Any updates on how long it will take for Unity 6 to be supported by OneSignal? It would be beneficial to not have to do manual fixes for builds

@jkasten2
Copy link
Member

jkasten2 commented Apr 2, 2025

Sorry for the delay on this issue. A fix for this Unity 6 build issue with Android will be available next week with the version number 5.1.13.

As a workaround for now, you can make the change manually to your project:

  1. Open Assets/Plugins/Android/OneSignalConfig.androidlib/build.gradle
  2. Add namespace 'com.onesignal.onesignalsdk' in the android { } section.

Full example:

apply plugin: 'com.android.library'

android {
    namespace 'com.onesignal.onesignalsdk'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
        }
    }

    def unityLib = project(':unityLibrary').extensions.getByName('android')

    defaultConfig {
        consumerProguardFiles "consumer-proguard.pro"
        minSdkVersion unityLib.defaultConfig.minSdkVersion.mApiLevel
        targetSdkVersion unityLib.defaultConfig.targetSdkVersion.mApiLevel
    }

    compileSdkVersion unityLib.compileSdkVersion
    buildToolsVersion unityLib.buildToolsVersion

    lintOptions {
        abortOnError false
    }
}

Thanks to @IvanMurzak for providing this workaround.

@jkasten2
Copy link
Member

jkasten2 commented Apr 17, 2025

This is now fixed in the OneSignal-Unity-SDK 5.1.13 release.

We ensured the build.gradle file gets updated automatically, so no manual steps are needed after upgrading the SDK.

  • Your source control will notice that Assets/Plugins/Android/OneSignalConfig.androidlib/build.gradle changed, you can check in / commit this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants