Bug 20970 - Using a @string/resourceName in manifest package attribute make xam tools fail to use the correct package name
Summary: Using a @string/resourceName in manifest package attribute make xam tools fai...
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.14.0
Hardware: PC Windows
: Low enhancement
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-06-29 09:44 UTC by softlion
Modified: 2017-06-28 18:14 UTC (History)
2 users (show)

Tags: bb
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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description softlion 2014-06-29 09:44:56 UTC
I have an androidmanifest.xml file which works correctly and starts with these lines:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="@string/AppPackageCode" android:versionCode="2" android:versionName="1.1" android:installLocation="auto">

The xam tools don't follow the @string/AppPackageCode indirection and use a strange package name instead: x_string_AppPackageCode.x_string_AppPackageCode

This setup is fully supported by android tools.
This bug in xam tools prevents me from creating clones of my app with the same common files.

Plz fix it.
Comment 1 softlion 2014-06-29 09:51:48 UTC
Please note that, in order to reproduce the pb, the @string/AppPackageCode resource should be created in a strings.xml file in an android library project !
Comment 2 Jonathan Pryor 2014-06-30 12:16:57 UTC
Don't count on this being fixed anytime soon.

> This bug in xam tools prevents me from creating clones of my app with the same

You can instead override the $(AndroidManifest) MSBuild property to refer to a different AndroidManifest.xml file with a different /manifest/@package attribute value.

Possibly relevant: https://forums.xamarin.com/discussion/590/one-solution-for-many-clients

The reason this won't be fixed anytime soon is that the package name is used in numerous places by the build process itself: it's used for `aapt --custom-package` (for library project support), it's used to determine the output filename, etc. It's use is _not_ constrained to "just" aapt.

As such, in order to allow /manifest/@package to be an Android string resource, we would need to implement an Android resource parser (so that it could be looked up in the same way that aapt does things), which in turn is (1) not trivial, and (2) even if we did so would likely add a not insignificant amount of time overhead for common build operations.

I'm not saying it'll never be fixed. I'm saying that if it will be fixed, it won't be anytime soon.
Comment 4 Tom Opgenorth 2017-06-28 18:14:59 UTC
Sounds like Jonathan Pryor answered the question in Comment 2 (https://bugzilla.xamarin.com/show_bug.cgi?id=20970#c2).