Skip to content
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

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

Open
1 task done
IvanMurzak opened this issue Oct 16, 2024 · 2 comments

Comments

@IvanMurzak
Copy link

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
    }
}

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

1 participant