Bug 54451 - Merged AndroidManifest.xml's from __library_project_imports__ don't include package name prefix
Summary: Merged AndroidManifest.xml's from __library_project_imports__ don't include p...
Status: IN_PROGRESS
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.2 (15.1)
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-04-04 14:24 UTC by Jon Dick
Modified: 2017-10-26 17:51 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 54451 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
IN_PROGRESS

Description Jon Dick 2017-04-04 14:24:30 UTC
With Google Play Services, we heavily rely on the merging of AndroidManifest.xml files from the .AAR files we bind.

Currently, when an AndroidManifest.xml file inside of an .aar contains something like this:

  <manifest package="com.google.android.gms.auth.api" ... >
    <application>
      <activity android:name=".signin.internal.SignInHubActivity" ... />
      ...

We expect the activity to be merged into our app's manifest with the package name prefixed to the name, so the result would be:
      <activity android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" ... />

This is not happening in the latest beta channel (Xamarin.Android 7.2.0.7), instead we get the activity merged like this:
      <activity android:name=".signin.internal.SignInHubActivity" ... />

This breaks anyone's app trying to use these libraries where the declarations are required.

This appears to be happening to for service dellarations too, so I'd expect it's a general problem with any element (broad cast receivers, intent filters, etc).


If you want to reproduce this, create a new android app project.

Add the Xamarin Google Play Services - Auth NuGet package to your app.

Build the app, and look at your obj/Debug/android/AndroidManifest.xml file, and note the entries with the ".signin.internal.SignInHubActivity" entry...
Comment 1 Jon Dick 2017-04-04 17:06:05 UTC
Sadly, I don't think this did ever work correctly.  This code appears to be largely unchanged:

https://github.com/xamarin/xamarin-android/blob/b423ff68a6d11230bb493c3cb0633ff2a9c37b20/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs#L340-L360
Comment 2 Jon Dick 2017-04-04 17:06:59 UTC
Here is some more documented info on how the merge process should be handled:
https://developer.android.com/studio/build/manifest-merge.html
Comment 3 Jon Dick 2017-04-11 12:31:20 UTC
In the meantime we've adjusted Xamarin.Build.Download to perform the `android:name` attribute merging with the package name from the source manifest file.

https://github.com/xamarin/XamarinComponents/commit/2824d7ed5ee6555bfdf448289b01732e12c51ba9

Xamarin.Build.Download v0.4.4-beta1 and newer should have this enabled.