Issue Description
Creating an Appcelerator project targeting Android that uses the Titanium theme using 6.2.2.GA causes certain UI elements to not work. In some cases, this results in warning messages being logged and no activity, in others, errors are logged and an error dialog appears in the app, and in others, the app crashes entirely.
The cases that we have identified so far are: optionDialogs, alertDialogs, and switches; however, considering the theming of many items also appears to have been changed unexpectedly, it seems likely that there are issues occurring with other elements that we have not noticed.
Steps to replicate
Here's a github link to a project that recreates the issues I've mentioned:
https://github.com/bbuehler-axway-support/android-titanium-theme
Please note that in this project, for the switch element, we are adding this via JavaScript in the controller, rather than creating an XML version. This is because creating an XML version causes the app to crash immediately on loading the page, which isn't terribly useful for testing. Additionally, as I do not see any changes to the Titanium Theme mentioned in the release notes, I would expect that rather than the Titanium Theme changing, other changes to Android in this SDK version have caused compatibility issues with the theme.
I can reproduce this issue on the below environment. If I comment out the code in [this commit](https://github.com/appcelerator/titanium_mobile/pull/8911/commits/0ebe4cc66866cea2966f5a9b7fc73d320059b51b) the issue does not occur OnePlus 3: 7.1.1 Ti SDK: 6.0.4.GA, 6.1.0.GA, 6.1.1.v20170608162457
Steps to reproduce
Download the application in the descripton
Run the application to Android device
Tap a button
Actual
When I tap on Add Switch, the below error is thrownExpected
The UI element corresponding to the button tapped should be added, i.e Add switch adds a switch[~rramirez]
Theme.Titanium
inherits the theme set in<application android:theme="..."
, in yourtiapp.xml
you are doing this:So
Theme.Titanium
is inheriting itself, which is bad. Just remove that line, or use a different name for your theme. We should add validation to prevent this from happening.Master: https://github.com/appcelerator/titanium_mobile/pull/9134 6_1_X: https://github.com/appcelerator/titanium_mobile/issues/9135 -I believe this should be backported to 6_1_X, will set up the backport once permission is granted-
FR passed for both master & backport PR.
Verified the fix with SDK 6.1.1.v20170612141743. Waiting for master SDK from jenkins to close.
Verified the fix with SDK 6.2.0.v20170613091505. Closing. Studio Ver: 4.9.0.201705302345 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.2 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1 Emulator: Android 4.4.2