Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27084

Android: "tiapp.xml" is unable to override "AndroidManifest.xml" settings defined in AAR or "timodule.xml"


    • Story Points:
    • Sprint:
      2019 Sprint 11


      The "tiapp.xml" file's "AndroidManifest.xml" settings is unable to override the XML elements such as <activity/>, <receiver/>, etc. that are defined in a native module's "timodule.xml" or a native AAR library's embedded "AndroidManifest.xml".

      Example Use-Case:
      Microsoft's authentication library (aka: MSAL) requires the app developer to override its com.microsoft.identity.client.BrowserTabActivity in the app project's "AndroidManifest.xml" and add an intent-filter to it. This is needed the Chrome web browser app will return the end-user back to the app that requested single-signon.

      Steps to Reproduce:

      1. Create a Titanium Classic "Default Project".
      2. Insert the android manifest XML settings below into the "tiapp.xml" file.
      3. Create the follow subfolders under the project: ./platform/android
      4. Copy this ticket's msal-0.2.2.aar file to the ./platform/android folder.
      5. Build the app for Android.
      6. Go to the project's ./build/android directory via Finder/WindowsExplorer.
      7. Open the "AndroidManifest.xml" file.
      8. Notice that the <intent-filter/> shown below was not injected into the "AndroidManifest.xml" file. (This is the bug.)

      <?xml version="1.0" encoding="UTF-8"?>
      <ti:app xmlns:ti="http://ti.appcelerator.org">
      	<android xmlns:android="http://schemas.android.com/apk/res/android">
      				<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
      						<action android:name="android.intent.action.VIEW"/>
      						<category android:name="android.intent.category.DEFAULT"/>
      						<category android:name="android.intent.category.BROWSABLE"/>
      						<data android:scheme="msauth" android:host="my.domain.com" android:path="my-path"/>

      Recommended Fix:
      We should change the finalAndroidManifest merge order in the SDK's "_build.js" script here. The order should be:

      1. this.androidLibraries.forEach(/* finalAndroidManifest.merge(am) */)
      2. this.modules.forEach(/* finalAndroidManifest.merge(am) */)
      3. finalAndroidManifest.merge(customAndroidManifest)
      4. finalAndroidManifest.merge(tiappAndroidManifest)

      Delete the XML setting that you want to override from the "timodule.xml" file or AAR file. Note that you can unzip an AAR file, change its embedded "AndroidMainfest.xml" file, and then re-zip it. Changing the AAR library's extension from ".aar" to ".zip" is an easy way to unzip it.




            • Assignee:
              jquick Joshua Quick
              jquick Joshua Quick
              Yordan Banev
              Keerthi Mahalingam (Inactive)
            • Watchers:
              2 Start watching this issue


              • Created:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration