Skip to content

Android - Support custom manifestPlaceholders in Dependencies.xml #250

@jkasten2

Description

@jkasten2

Issue

Some plugins have custom manifestPlaceholders that must be set, otherwise AndroidManifest.xml merge errors will occur at build time. These are normally set in the app/build.gradle for an Android Studio project.
Example:

android {
   defaultConfig {
      manifestPlaceholders = [
          key1: 'value1',
          key2: 'value2'
      ]
    }
 }

To be clear I am not referring to the applicationId, but custom placeholders.

Possible Solutions

Option 1

<dependencies>
  <androidPackages>
    <androidPackage spec="com.plugin.example:example-module:[1.0.0, 2.0.0[">
       <manifestPlaceholders>
         <item name="key1">value1<entry>
         <item name="key2">value2<entry>
       </manifestPlaceholders>
    </androidPackage>
</dependencies>

Since there will be a PluginNameDependencies.xml for each plugin this would a straightforward spot to put them.

Option 2

A new PluginNameManifestPlaceholders.xml file each plugin could define. Since manifestPlaceholders are scoped to the gradle project this fits better into how gradle really defines manifestPlaceholders

Option 3

Something build into Unity I am missing?
There does seem to be some kind of settingsTemplate.gradle file.
https://docs.unity3d.com/Manual/android-gradle-overview.html
However it seems like this does not automatic get imported according to this note from the link above.

You can also use your own settings.gradle file by providing a settingsTemplate.gradle file in your Plugins directory in the same way (although there is currently no automatic way to do this).
Regardless I did try creating a settingsTemplate.gradle file however Unity didn't seem to pick it up.

@stewartmiles Maybe you have some experience with with this Unity feature already?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions