0

I'm building an AAR library for Android and need to include a ContentProvider in the library's manifest, as such:

<provider
    android:name="sdk.example.Preferences"
    android:authorities="${applicationId}.preferences"
    android:exported="false"
    />

The problem is that when the AAR is built, ${applicationId} is replaced by the AAR's package. What I want is for the manifest of the final AAR to keep ${applicationId} so that it can be replaced with the main application's package when it itself is built. Any idea how to do this?

Currently I'm editing the AAR manually to achieve this, but want to find a better solution

Cigogne Eveillée
  • 2,178
  • 22
  • 36

2 Answers2

0

Well - the first approach that comes to mind is to use a resource for the authority name, but this is not possible - Using @string for android:authorities in a ContentProvider.

There is however a Maven job that replaces the authority, but I have no idea how it behaves when AAR libraries are involved - Android Manifest with @String reference - specifically android:authorities.

Please report your solution.

Community
  • 1
  • 1
Vaiden
  • 15,728
  • 7
  • 61
  • 91
0

This is now done automatically in Android Studio 2.0

Cigogne Eveillée
  • 2,178
  • 22
  • 36