[TIMOB-15981] Custom AndroidManifest.xml is being overwritten
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-12-16T08:18:42.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | 2013 Sprint 26, 2013 Sprint 26 Core, Release 3.2.0, Release 3.3.0 |
Components | Android |
Labels | android-manifest, module_build, overwrite, qe-testadded |
Reporter | Meenakshi Pathak |
Assignee | Chris Barber |
Created | 2013-12-13T10:57:08.000+0000 |
Updated | 2014-03-13T18:06:45.000+0000 |
Description
In SDK version 3.2.0, every build replaces the AndroidManifest.xml entries. Even if we delete any 'permission' in the manifest which we don't require for example:
}.
4. Again build the project and see that the deleted entry has regenerated again in the custom AndroidManifest.xml again.
*Expected Behavior* : If we want to disable any of the permissions, we could do it by making custom androidManifest.xml as we did before SDK version 3.2.0
*Note* : In 3.1.3, Custom AndoidManifest.xml is not being overwritten. Everything works fine as expected.
<service android:name="org.appcelerator.titanium.analytics.TiAnalyticsService" android:exported="false"/>
<!-- OR-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
It again shows in the AndroidManifest.xml.
*Steps To Reproduce*
1. Create a Titanium project and build it for android device.
2. Copy the AndroidManifest.xml from build folder and paste it under /platform/android folder.
3. Delete any permission let say {
Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5123 3.2.x pull request: https://github.com/appcelerator/titanium_mobile/pull/5124
In the new CLI, we add permissions that are needed for the code to run. If the CLI detects that a certain permission is needed, it will automatically be added, even if you omit it in your custom manifest. The custom android manifest also gets merged with a default one, and any custom manifest properties inside tiapp.xml. If there is a conflict, the value from tiapp.xml takes precedence. There is a problem where the original custom manifest inside platform/android gets overwritten with the default one plus anything from the tiapp.xml. This should not happen, and the PRs mentioned should fix this issue. To test that problem do the following: 1. Build an android app once 2. Copy the AndroidManifest from the build directory and place it in platform/android/AndroidManifest.xml 3. Modify the custom manifest in step 2 to have
4. Inside you tiapp.xml place the following in your android node:
Expected: The AndroidManifest inside the build directory should have android:minSdkVersion="10" android:targetSdkVersion="10" AND the custom AndroidManifest inside platform/android should remain UNCHANGED (with a value of android:minSdkVersion="11" android:targetSdkVersion="11" Actual: The custom android manifest in platform/android has android:minSdkVersion="10" android:targetSdkVersion="10"
As per document: If there is a conflict between the custom manifest properties and the value from tiapp.xml, then tiapp.xml takes precedence. Now I followed the above mentioned step and got the same result. I also tried with test app:
Steps to reproduce: 1)Copy paste the code in app.js of new default classic app. 2) Run the app. 3) Copy the AndroidManifest from the build directory and place it in platform/android/AndroidManifest.xml 4) Delete all the permissions from custom manifest file and run the app again. Expected Result: 1) According to the CLI change app must run successfully but custom manifest file must not change. Actual Result: 1) App runs successfully but custom manifest file also changes. Automatically the removed permissions are added. Though the permissions are added from CLI as they are needed to run the code. But then the custom manifest file must not change. Same code when ran with 3.1.3.GA and 3.1.2.GA using the custom manifest without adding any permissions then we get run time error with message permission denied. Tested Environment: Appcelerator Studio: 3.2.0.201312151544 SDK:3.2.0.v20131215211321 alloy: 1.3.0-cr acs: 1.0.10 npm: 1.3.2 titanium: 3.2.0-cr3 titanium-code-processor: 1.1.0-cr2 Xcode:5.0.2 OS: Mac OSX 10.9 Device: Google Nexus7(v4.3)
Build failed. Please retry with SDK with SHA https://github.com/appcelerator/titanium_mobile/commit/2a93aca76a566c14e07ea0f42b6e349c9e2a93cb or later.
Verified the fix. The custom androidmanifest.xml in "platform/android" does not change after building the app. Closing. Environment: Appcel Studio : 3.2.0.201312151544 Ti SDK : 3.2.0.v20131216064236 Mac OSX : 10.8.5 Alloy : 1.3.0-cr CLI - 3.2.0-cr3 Samsung Galaxy S4 running android 4.2.2
I tested and can still reproduce the issue. Here are my environment details: Titanium SDK version: 3.2.0.v20131216191854 CLI version: 3.2.0-cr3 Titanium Studio: 3.2.0.201312162209 Nexus 4, Android 4.4
[~btran], which issue were you able to reproduce? The original one in the ticket is not a bug, but a new feature with the CLI. It forces some of the permissions back if it detects that the app uses it. Does the AndroidManifest.xml inside platform/android get modified? If so, could you provide more details on what you did. Thanks.
My mistake, I am no longer able to reproduce the problem