1 # 2 # Test: 3 # - Activities from libraries are merged in the main manifest. 4 # - Acts on activity / activity-alias / service / receiver / provider. 5 # - Elements are merged as-is with the first comment element preceding them. 6 # - Whitespace preceding the merged elements is transfered over too. 7 # 8 # Note: 9 # - New elements are always merged at the end of the application element. 10 # - It's an error if an element with the same @name attribute is defined 11 # or merged more than once unless the definition is *exactly* the same, 12 # the "same" being defined by the exact XML elements, whitespace excluded. 13 # 14 # This tests that an error is generated because the libraries define 15 # providers which are already defined differently. 16 # 17 18 @fails 19 20 @main 21 22 <manifest 23 xmlns:android="http://schemas.android.com/apk/res/android" 24 package="com.example.app1" 25 android:versionCode="100" 26 android:versionName="1.0.0"> 27 28 29 <application 30 android:label="@string/app_name" 31 android:icon="@drawable/app_icon" 32 android:backupAgent="com.example.app.BackupAgentClass" 33 android:restoreAnyVersion="true" 34 android:allowBackup="true" 35 android:killAfterRestore="true" 36 android:name="com.example.TheApp" > 37 38 <provider 39 android:name="com.example.Provider1" 40 android:authorities="com.example.android.apis.app.thingy1" 41 android:enabled="@bool/someConditionalValue" /> 42 43 <provider 44 android:name="com.example.Provider2" /> 45 46 </application> 47 48 </manifest> 49 50 @lib1 51 52 <manifest 53 xmlns:android="http://schemas.android.com/apk/res/android" 54 package="com.example.lib1"> 55 56 <application android:label="@string/lib_name1" > 57 58 <!-- Same as MyActivity1 in main --> 59 <provider 60 android:name="com.example.Provider1" 61 android:authorities="com.example.android.apis.app.thingy1" 62 android:enabled="@bool/someConditionalValue" /> 63 64 <!-- Differs from MyActivity2 in main --> 65 <provider 66 android:name="com.example.Provider2" 67 android:authorities="com.example.android.apis.app.thingy2" 68 android:enabled="@bool/someConditionalValue2" /> 69 70 <!-- A new one defined by lib1 --> 71 <provider 72 android:name="com.example.Provider3" 73 android:authorities="com.example.android.apis.app.thingy3" 74 android:enabled="@bool/someConditionalValue" /> 75 76 </application> 77 78 </manifest> 79 80 @lib2 81 82 <manifest 83 xmlns:android="http://schemas.android.com/apk/res/android" 84 package="com.example.lib2"> 85 86 <application android:label="@string/lib_name2" > 87 88 <!-- Conflicts with 3 from lib1 --> 89 <provider 90 android:name="com.example.Provider3" 91 android:authorities="com.example.android.apis.app.thingy3" /> 92 </application> 93 94 </manifest> 95 96 97 @result 98 99 <manifest 100 xmlns:android="http://schemas.android.com/apk/res/android" 101 package="com.example.app1" 102 android:versionCode="100" 103 android:versionName="1.0.0"> 104 105 106 <application 107 android:label="@string/app_name" 108 android:icon="@drawable/app_icon" 109 android:backupAgent="com.example.app.BackupAgentClass" 110 android:restoreAnyVersion="true" 111 android:allowBackup="true" 112 android:killAfterRestore="true" 113 android:name="com.example.TheApp" > 114 115 <provider 116 android:name="com.example.Provider1" 117 android:authorities="com.example.android.apis.app.thingy1" 118 android:enabled="@bool/someConditionalValue" /> 119 120 <provider 121 android:name="com.example.Provider2" /> 122 123 <!-- A new one defined by lib1 --> 124 <provider 125 android:name="com.example.Provider3" 126 android:authorities="com.example.android.apis.app.thingy3" 127 android:enabled="@bool/someConditionalValue" /> 128 129 </application> 130 131 </manifest> 132 133 @errors 134 135 P [ManifestMergerTest0_main.xml:6, ManifestMergerTest1_lib1.xml:6] Skipping identical /manifest/application/provider[@name=com.example.Provider1] element. 136 E [ManifestMergerTest0_main.xml:8, ManifestMergerTest1_lib1.xml:9] Trying to merge incompatible /manifest/application/provider[@name=com.example.Provider2] element: 137 <provider android:name=com.example.Provider2> 138 -- @android:authorities = com.example.android.apis.app.thingy2 139 -- @android:enabled = @bool/someConditionalValue2 140 @android:name = com.example.Provider2 141 E [ManifestMergerTest0_main.xml, ManifestMergerTest2_lib2.xml:6] Trying to merge incompatible /manifest/application/provider[@name=com.example.Provider3] element: 142 <provider android:name=com.example.Provider3> 143 @android:authorities = com.example.android.apis.app.thingy3 144 ++ @android:enabled = @bool/someConditionalValue 145 @android:name = com.example.Provider3 146