ClassNotFound exception with multidex on pre 21 android
Reported by
patterso...@gmail.com,
Apr 27 2017
|
|||||||||||
Issue descriptionSteps to reproduce the problem: 1. Go over the 64k method limit 2. Build with multidex using a pre 21 android device 3. What is the expected behavior? Not to crash on start up What went wrong? Crashes on start up due to ClassNotFoundExceptions. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 54.0.2840.9 Channel: stable OS Version: 20 and below Flash Version:
,
Apr 27 2017
,
Apr 27 2017
,
Nov 27 2017
,
Dec 1 2017
pattersondan2011@ Are you still seeing this issue in latest chrome version - 62.0.3202.84?
,
Dec 1 2017
I ended up resolving this problem by adding efficient proguard rules for the chromium google library classes. I was adding support for google mobile ads, and had added the line -keep public class com.google.android.gms.ads.** { *;} to the src/third_party/android_tools/proguard.flags. This worked in dev mode because multidexing is enabled, but a release build would fail because multidexing is disabled, having this line caused the app to go well above the 64k limit with the other sdks we had added to the project. So instead I ended up figuring out the direct classes that I needed for google mobile ads.
-keep public class com.google.android.gms.common.api.Api* {*;}
-keep public class com.google.android.gms.common.api.CommonStatusCodes {*;}
-keep public class com.google.android.gms.common.api.GoogleApiClient* {*;}
-keep public class com.google.android.gms.common.api.PendingResult {*;}
-keep public class com.google.android.gms.common.api.ResultCallback {*;}
-keep public class com.google.android.gms.common.api.Status {*;}
-keep public class com.google.android.gms.common.ConnectionResult {*;}
-keep public class com.google.android.gms.common.GoogleApiAvailability {*;}
-keep public class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep public class com.google.android.gms.common.GooglePlayServicesNotAvailableException {*;}
-keep public class com.google.android.gms.common.GooglePlayServicesRepairableException {*;}
-keep public class com.google.android.gms.ads.identifier.** {*;}
The above are the new lines I added, although not sure I need them all just for ads. The last line might be all I needed, or last 5 lines, not sure anymore.
By replacing -keep public class com.google.android.gms.ads.** { *;} with that last block of proguard rules I was able to knock off 10k or so methods, and it built.
Unfortunately we are still on 54.0.2840.9 and will need to upgrade at some point...
,
Dec 1 2017
Thank you for providing more feedback. Adding requester "ligimole@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 4 2018
pattersondan2011@ -- Request you to update your Chrome to latest #65.0.3325.109 and let us know your observations.
,
Apr 5 2018
We upgraded to 65.0.3317.0, not running into any size limit errors, but we are close to hitting it with the third party sdks we are using.
,
Apr 5 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 13 2018
Adding the label 'TE-NeedsTriageHelp' as the issue seems to be out of TE's scope. Thanks!
,
May 17 2018
Looping to sheriff for further updates.
,
May 25 2018
There were lot of fixes made in chrome to not hit dex method limit: https://bugs.chromium.org/p/chromium/issues/detail?id=820570 I suggest you start with updating your chromium branch. |
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by patterso...@gmail.com
, Apr 27 2017