Bug 4535 - AndroidManifest
Summary: AndroidManifest
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.1.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-19 16:03 UTC by chuard.marc
Modified: 2012-04-19 17:07 UTC (History)
2 users (show)

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


Attachments
Dia.Face (1.54 MB, application/x-zip-compressed)
2012-04-19 16:31 UTC, chuard.marc
Details


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 INVALID

Description chuard.marc 2012-04-19 16:03:35 UTC

    
Comment 1 chuard.marc 2012-04-19 16:31:44 UTC
Created attachment 1705 [details]
Dia.Face
Comment 2 Jonathan Pryor 2012-04-19 17:07:52 UTC
The problem is that when  you attempt to install the attached project, it fails with:

    Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

Looking at logcat, you'll find:

> W/PackageParser(24096): /data/app/vmdl-1541342243.tmp (at Binary XML file line #10): <provider> does not have valid android:name

The reason for this is that Android hates PascalCase type names, which you include in Properties\AndroidManifest.xml:

	<provider android:name="Dia.Face.DiaPadContentProvider"
		android:authorities="DiaPad.LocationProvider" />

Seriously: they validate that if android:name contains a '.', the '.' is either the first character OR that the first character is a lowercase letter:

https://github.com/android/platform_frameworks_base/blob/master/core/java/android/content/pm/PackageParser.java#L1260

This is why Mono for Android lowercases namespace names.

The fix is twofold:

1. Edit DiaPadContentProvider.cs, and add a [ContentProvider] custom attribute:

	[ContentProvider(new[]{"DiaPad.LocationProvider"})]
	class DiaPadContentProvider : ContentProvider
	// ...

2. REMOVE the <activity/> and <provider/> elements from AndroidManifest.xml; they're not needed and harmful.

The <activity/> element won't cause any compilation errors, but it will cause a second Launcher icon to be displayed, and if you tap on the "wrong" icon it'll crash during app startup (as the type Dia.Face.eventactivity won't exist).

The <provider/> element is preventing installation of your app.

Thanks,
 - Jon