Recent problems building chrome_public_test_apk (Android)

198 views
Skip to first unread message

Kevin

unread,
Apr 4, 2017, 9:11:30 PM4/4/17
to Chromium-dev
I have run into the 64K method limit while building chrome_public_test_apk.  I added enable_multidex=true to the instrumentation_test_apk("chrome_public_test_apk") rule in chorme/Android/BUILD.gn, which solved the problem for release builds.  However, in a debug build, I am getting a related error:

FAILED: gen/chrome/android/chrome_public_test_apk__apk/classes.dex.zip 
python ../../build/android/gyp/dex.py --depfile gen/chrome/android/chrome_public_test_apk__apk__final_dex.d --android-sdk-tools ../../third_party/android_tools/sdk/build-tools/24.0.2 --dex-path gen/chrome/android/chrome_public_test_apk__apk/classes.dex.zip --incremental --multi-dex --main-dex-list-path gen/chrome/android/chrome_public_test_apk__apk/classes.dex.zip.main_dex_list --inputs=@FileArg\(gen/chrome/android/chrome_public_test_apk__apk.build_config:dist_jar:dependency_jars\) gen/chrome/android/chrome_public_test_apk__apk/chrome_public_test_apk__apk.jar

  ... Snipped ...

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded

Some quick googlin suggested that I change the minSdk to 1 or use proguard, but the general rule in Chromium seems to be that proguard is not used for debug builds.  In most of the manifests the minimum SDK is set to 16, so I'm not sure that is the right answer either.

Any advice will be appreciated

  - Kevin

Qualcomm Innovation Center, Inc.

Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

John Budorick

unread,
Apr 4, 2017, 9:25:25 PM4/4/17
to kh...@codeaurora.org, Chromium-dev
What gn arguments are you building with? Are you building with current trunk, or with a build that incorporates other changes?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/52abc40d-c439-463c-aabc-16552649f463%40chromium.org.

Kevin

unread,
Apr 5, 2017, 1:25:47 PM4/5/17
to Chromium-dev, kh...@codeaurora.org
is_component_build = false
is_debug = true
target_os="android"
cc_wrapper="ccache"

This is a relatively recent dev build (59.0.3056.0) with fairly extensive local changes.
  - Kevin

Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.


Holger

unread,
Apr 5, 2017, 2:28:56 PM4/5/17
to Chromium-dev
Is there any reason we are not using the same multidex config as ChromePublic.apk for the tests?

ChromePublic already uses MultiDex on Debug builds - the tests should probably do the same.
(I haven't run a Dex-check recently, but it's possible that your local changes bumped the test apk above 65k, I don't think Chrome was very far from the limit last time I checked)

Holger

unread,
Apr 5, 2017, 2:32:31 PM4/5/17
to Chromium-dev
Hm, did you make any gn changes?

I just did a dexcount on ChromePublicTest.apk from today's master:
Overall method count: 35662

That's very far from the limit.
--> Any dependency you added that might have pulled in something you didn't want to pull in?

Kevin

unread,
Apr 5, 2017, 2:37:29 PM4/5/17
to Chromium-dev
My current understanding of my problem is that multidex is enabled (with my change), but because proguard is not enabled for a debug build, the main dex itself ends up with over 65536 entries.  (Release build is OK).  I'm not sure why this wouldn't be a problem for ChromePublic.apk as well.  But I'm pretty fuzzy on all of this.

  - Kevin

Kevin

unread,
Apr 5, 2017, 5:01:54 PM4/5/17
to Chromium-dev
OK, I guess I'll have to run dexcount on the baseline and see where the delta is coming from.  I'm not familiar with dexcount, and the references I've found online all seem to describe it as a gradle plugin.  How do I use dexcount in the context of a gn / ninja build?

Kevin

unread,
Apr 5, 2017, 6:06:04 PM4/5/17
to Chromium-dev
Never mind, using https://github.com/mihaip/dex-method-counts.  The investigation continues.

Kevin

unread,
Apr 5, 2017, 8:36:59 PM4/5/17
to Chromium-dev
I'm getting 61591 method IDs in ChromePublicTest.apk, in a baseline m58 build.

target_os = "android"
is_debug = false
symbol_level = 1

Top-level output of dex-method-counts:
Processing ChromePublicTest.apk
Read in 61591 method IDs.
<root>: 61591
    <default>: 1
    android: 14566
    com: 6839
    dalvik: 6
    java: 1262
    javax: 48
    jp: 50
    junit: 131
    org: 38682
Overall method count: 61591

Details of org:
    org: 38682
        chromium: 38580
            base: 948
            chrome: 30602 
                browser: 29924
                test: 677   
            components: 1208
            content: 1973   
            device: 747
            media: 510
            midi: 78
            mojo: 387
            net: 338
            payments: 228
            policy: 58
            printing: 79
            service_manager: 22
            services: 8
            shape_detection: 157
            test: 16
            third_party: 293
            ui: 583
            url: 6
            webapk: 101
            webshare: 36

Kevin

unread,
Apr 7, 2017, 1:49:31 PM4/7/17
to Chromium-dev
Any idea why I'm getting such different results?  (attached)


On Wednesday, April 5, 2017 at 11:32:31 AM UTC-7, Holger wrote:
foo

Holger

unread,
Apr 7, 2017, 2:49:52 PM4/7/17
to Chromium-dev
Seems you switched over to a Release build when doing the dexcount this time.
Not sure if there should be large differences between release and debug, but my dex count above was based on a debug build.

John Budorick

unread,
Apr 12, 2017, 3:54:25 PM4/12/17
to Kraus, Holger, Chromium-dev
We've started seeing this in some build configurations in trunk and are now tracking it in crbug/710811 (internal due to some of the configurations involved). I'm looking into our main dex list generation in debug builds.

(Somewhat of an aside -- we've been using //build/android/method_count.py to track method counts for a while, though we do so indirectly nowadays via resource_sizes.py. It doesn't break methods down by package, though.)

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

Kevin

unread,
Apr 14, 2017, 8:20:30 PM4/14/17
to Chromium-dev, kra...@amazon.com
Thanks for following up.  Please let me know if and when this is tracked by a public bug.

John Budorick

unread,
Apr 18, 2017, 5:33:07 PM4/18/17
to kh...@codeaurora.org, Chromium-dev, Kraus, Holger
Reply all
Reply to author
Forward
0 new messages