Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25964] Android: Merge manifest of Android Libraries

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2018-05-11T21:21:13.000+0000
Affected Version/sRelease 7.1.0
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsn/a
ReporterJan Vennemann
AssigneeJan Vennemann
Created2018-04-13T20:44:40.000+0000
Updated2018-06-21T21:14:11.000+0000

Description

The AndroidManifest.xml of an Android Library (.aar) needs to be merged into the final app manifest.

Comments

  1. Jan Vennemann 2018-04-13

    PR: https://github.com/appcelerator/titanium_mobile/pull/10002 Gradle support the usage of placeholders in the manifest for which there is no direct mapping in our handling of .aar files. To workaround this one can hook into build.android.writeAndroidManifest. Library AndroidManifest.xml (excerpt):
       <provider
                   android:name="com.zimperium.zdetection.db.contentprovider.ZDetectionProvider"
                   android:authorities="${localApplicationId}.zdetection.provider"
                   android:exported="true" />
       
    with Gradle configuration (excerpt)
       manifestPlaceholders = [localApplicationId: applicationId]
       
    The same can be achieved with this hook:
       exports.id = 'zdetection.manifest.placeholders';
       exports.init = (logger, config, cli) => {
       	cli.on('build.android.writeAndroidManifest', {
       		pre: (data, done) => {
       			const manifest = data.args[1];
       			Object.keys(manifest.application.provider).forEach(providerName => {
       				if (providerName === 'com.zimperium.zdetection.db.contentprovider.ZDetectionProvider') {
       					const provider = manifest.application.provider[providerName];
       					provider.authorities = provider.authorities.replace('${localApplicationId}', cli.tiapp.id);
       				}
       			});
       			done();
       		}
       	});
       };
       
  2. Lokesh Choudhary 2018-06-21

    Verified the fix in SDK 7.3.0.v20180618182516. Closing.

JSON Source