{ "id": "170564", "key": "AC-5431", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-01-03T22:02:57.000+0000", "created": "2017-12-08T08:18:43.000+0000", "labels": [], "versions": [], "issuelinks": [ { "id": "56204", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "170593", "key": "TIMOB-25597", "fields": { "summary": "Android: Multidexed apps crash on startup on Android 4.x", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-24T01:11:23.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Currently we have multi-dex support and have made it default which enables us compiling apps with massive libraries and works fine for Android 5+. But when the number of method goes above 65K the app completely stops working on Android 4.X.X which the SDK still claims to support.\r\n\r\nHere is what is mentioned in the Android Studio doc to enable multi-dex for devices running Android versions which were prior to 5.0.0: *[https://developer.android.com/studio/build/multidex.html#mdex-pre-l|https://developer.android.com/studio/build/multidex.html#mdex-pre-l]*\r\n\r\nI tried changing the android application name, i.e.:\r\n*\r\n*as mentioned in: [https://developer.android.com/studio/build/multidex.html#mdex-pre-l|https://developer.android.com/studio/build/multidex.html#mdex-pre-l]\r\nbut while trying to run the application, the app crashes with the error:\r\nE/AndroidRuntime(32659): java.lang.RuntimeException: Unable to start activity ComponentInfo\r\n{com.xyz/com.xyz.XYZActivity}\r\n: java.lang.ClassCastException: android.support.multidex.MultiDexApplication cannot be cast to org.appcelerator.titanium.TiApplication\r\nOr how can I override the attachBaseContext method on the Main application class?", "attachment": [], "flagged": false, "summary": "Android: Enable Multi-Dex support for Android 4.X.X", "creator": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "subtasks": [], "reporter": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "environment": null, "comment": { "comments": [ { "id": "431869", "author": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "body": "\r\n{code:java}\r\n\r\npackage org.appcelerator.titanium;\r\n\r\nimport android.content.Intent;\r\nimport android.os.Bundle;\r\nimport org.appcelerator.kroll.KrollDict;\r\nimport org.appcelerator.titanium.proxy.ActivityProxy;\r\nimport org.appcelerator.titanium.proxy.IntentProxy;\r\nimport android.support.multidex.MultiDex;\r\n\r\npublic class TiActivity extends TiBaseActivity\r\n{\r\n.\r\n.\r\n.\r\n @Override\r\n protected void attachBaseContext(Context base) {\r\n super.attachBaseContext(base);\r\n MultiDex.install(this);\r\n }\r\n.\r\n.\r\n.\r\n}\r\n{code}\r\n???", "updateAuthor": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2017-12-08T09:37:42.000+0000", "updated": "2017-12-08T09:40:56.000+0000" }, { "id": "431882", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Can you share a sample app that we can test to verify the issue in Android 4.x.x and also see the response in 5.x.x and above. Please provide a sample app and list of steps to follow for successful regeneration. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-12-08T21:37:00.000+0000", "updated": "2017-12-08T21:37:00.000+0000" }, { "id": "431904", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jquick] Thoughts?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-12-09T22:15:50.000+0000", "updated": "2017-12-09T22:15:50.000+0000" }, { "id": "431973", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I've confirmed that multidex support for Android 4.x isn't reliable and will mostly likely crash on app startup. For now, the only reliable work-around is to set the min supported Android OS version to 5.0 by adding the following to your \"tiapp.xml\" file...\r\n\r\n{code:xml}\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n*Technical Reason:*\r\nThe Titanium build tools needs to embed the \"TiApplication\" Java class and all of the Java classes it uses into the main dex file. This is because the application class needs to enable multidex support on Android 4.x, but the application class and its members need to be loaded successfully from the main dex file before doing so. This involves us passing a \"--main-dex-list\" command line argument when building a multidex app. This will never be a problem on Android 5.0 and above since those OS versions have built-in multidexing support.\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-12-11T19:29:53.000+0000", "updated": "2017-12-11T19:59:53.000+0000" }, { "id": "433560", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue will be resolved by the fix for [TIMOB-25597] in Titanium 7.0.2.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T01:10:41.000+0000", "updated": "2018-01-24T01:10:41.000+0000" }, { "id": "433561", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as duplicate.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-24T01:11:23.000+0000", "updated": "2018-01-24T01:11:23.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }