Build issue after upgrading chromium Android to 106

245 views
Skip to first unread message

Deepak Kumar

unread,
Nov 30, 2022, 8:00:59 AM11/30/22
to Chromium-dev
Hi Devs,
Recently I have upgraded my setup to 106 base of chromium for Android, we have used a third party sdk to show Ads and it was working fine with earlier versions, but with recent upgrade I started facing build issue.

Below is the error:
[7168/7172] ACTION //chrome/android:chrome_public_apk__final_dex(//build/toolchain/android:android_clang_arm64)
FAILED: obj/chrome/android/chrome_public_apk/chrome_public_apk.r8dex.jar apks/ChromePublic.apk.mapping
python3 ../../build/android/gyp/proguard.py --mapping-output apks/ChromePublic.apk.mapping --classpath @FileArg\(gen/chrome/android/chrome_public_apk.build_config.json:deps_info:proguard_classpath_jars\) --classpath @FileArg\(gen/chrome/android/chrome_public_apk.build_config.json:android:sdk_jars\) --r8-path ../../third_party/r8/lib/r8.jar --enable-obfuscation --sourcefile chromium-ChromePublic.apk-stable-120 --desugar-jdk-libs-json ../../third_party/r8/desugar_jdk_libs.json --desugar-jdk-libs-jar ../../third_party/android_deps/libs/com_android_tools_desugar_jdk_libs/desugar_jdk_libs-1.1.5.jar --desugar-jdk-libs-configuration-jar ../../third_party/android_deps/libs/com_android_tools_desugar_jdk_libs_configuration/desugar_jdk_libs_configuration-1.1.5.jar --desugared-library-keep-rule-output gen/chrome/android/chrome_public_apk__final_dex.desugared_library_keep_rules.flags --proguard-configs=@FileArg\(gen/chrome/android/chrome_public_apk.build_config.json:deps_info:proguard_all_configs\) --min-api=24 --input-paths=@FileArg\(gen/chrome/android/chrome_public_apk.build_config.json:deps_info:device_classpath\) --output-path obj/chrome/android/chrome_public_apk/chrome_public_apk.r8dex.jar --depfile gen/chrome/android/chrome_public_apk__final_dex.d

Above error is primary error I am getting, but it also maps to proguard.py and build_utils.py

Anyone has any idea or ever faced this error or any error which points to desugar libraries?


Deepak Kumar

unread,
Nov 30, 2022, 8:21:39 AM11/30/22
to Chromium-dev, Deepak Kumar
wanted to add one more point, difference in recent upgrade is android 33 support as well.

Deepak Kumar

unread,
Dec 16, 2022, 3:57:49 AM12/16/22
to Chromium-dev, Deepak Kumar
Hello Everyone,
Can anyone suggest any solution? I am still facing this build issue and got stuck.

Bruce Dawson

unread,
Dec 18, 2022, 3:04:11 PM12/18/22
to Chromium-dev, kr.dee...@gmail.com
I don't actually see any error message in the text that you shared - I just see the build command.

Can you share what gn args you are using, what platform you are building on, and what commit hash (git log -1 origin/main) you are on, and whether you have any local patches applied?

Bisecting can be a powerful tool for understanding where build errors come from. If you know of a commit where this build step worked and a commit where it fails, then checkout (and gclient sync -D) halfway between and try a build there. Repeating this can find the precise problematic commit quite efficiently. "git bisect" makes this easier. However, since Chromium is building fine on our bots and for other people this may not be helpful for you.

Also, Chromium 106 is quite old now - we just branched for M110 so the trunk is now on M111.

Deepak Kumar

unread,
Dec 19, 2022, 2:32:41 AM12/19/22
to Chromium-dev, bruce...@google.com, Deepak Kumar
Thanks for the response,
We are building chromium for Android, and we are using arguments for release build. below are the arguments
target_os = "android"
target_cpu = "arm64"
is_debug = false
is_java_debug = false

android_channel = "stable"
is_official_build = true
is_component_build = false

Yes after including local commit, which contains new dependency which got added for showing ads breaks the build. below is the more detailed error log
----------------------------
Traceback (most recent call last):
  File "../../build/android/gyp/proguard.py", line 734, in <module>
    main()
  File "../../build/android/gyp/proguard.py", line 722, in main
    _DoTraceReferencesChecks(options, split_contexts_by_name)
  File "../../build/android/gyp/proguard.py", line 641, in _DoTraceReferencesChecks
    if _CheckForMissingSymbols(options.r8_path, dex_files, options.classpath,
  File "../../build/android/gyp/proguard.py", line 507, in _CheckForMissingSymbols
    build_utils.CheckOutput(cmd,
  File "/home/ts_deepak_bharti/chromium105/src/build/android/gyp/util/build_utils.py", line 273, in CheckOutput
    raise CalledProcessError(cwd, args, stdout + stderr)
util.build_utils.CalledProcessError: Command failed: ( cd /home/ts_deepak_bharti/chromium105/src/out/Default; ../../third_party/jdk/current/bin/java -Xmx1G -noverify -cp ../../third_party/r8/lib/r8.jar com.android.tools.r8.tracereferences.TraceReferences --map-diagnostics:MissingDefinitionsDiagnostic error warning --check --lib ../../third_party/android_sdk/public/platforms/android-33/optional/org.apache.http.legacy.jar --lib ../../third_party/android_sdk/public/platforms/android-33/android.jar --source obj/chrome/android/chrome_public_apk/chrome_public_apk.r8dex.jar )
Error: java.lang.NullPointerException
Compilation failed with an internal error.
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    at com.android.tools.r8.utils.ExceptionUtils.withMainProgramHandler(ExceptionUtils.java:189)
    at com.android.tools.r8.tracereferences.TraceReferences.main(TraceReferences.java:109)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    at Version.fakeStackEntry(Version_main.java:0)
    at com.android.tools.r8.utils.ExceptionUtils.failWithFakeEntry(ExceptionUtils.java:139)
    at com.android.tools.r8.utils.ExceptionUtils.failCompilation(ExceptionUtils.java:89)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:83)
    at com.android.tools.r8.tracereferences.TraceReferences.run(TraceReferences.java:33)
    at com.android.tools.r8.tracereferences.TraceReferences.run(TraceReferences.java:94)
    at com.android.tools.r8.tracereferences.TraceReferences.lambda$main$3(TraceReferences.java:109)
    at com.android.tools.r8.utils.ExceptionUtils.withMainProgramHandler(ExceptionUtils.java:186)
    ... 1 more
Caused by: java.lang.NullPointerException
    at com.android.tools.r8.graph.MethodResolutionResult$Builder.lambda$buildOrIfEmpty$5(MethodResolutionResult.java:1544)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at com.android.tools.r8.graph.MethodResolutionResult$Builder.buildOrIfEmpty(MethodResolutionResult.java:1542)
    at com.android.tools.r8.graph.MethodResolutionResult$Builder.buildOrIfEmpty(MethodResolutionResult.java:1525)
    at com.android.tools.r8.graph.MethodResolution.resolveMethodOnClassStep2(MethodResolution.java:212)
    at com.android.tools.r8.graph.MethodResolution.resolveMethodOnClass(MethodResolution.java:156)
    at com.android.tools.r8.graph.MethodResolution.lambda$resolveMethodOnClass$2(MethodResolution.java:145)
    at com.android.tools.r8.graph.DexClass.forEachClassResolutionResult(DexClass.java:151)
    at com.android.tools.r8.graph.MethodResolution.resolveMethodOnClass(MethodResolution.java:139)
    at com.android.tools.r8.graph.AppInfoWithClassHierarchy.resolveMethodOnClass(AppInfoWithClassHierarchy.java:831)
    at com.android.tools.r8.graph.AppInfoWithClassHierarchy.resolveMethodOnClass(AppInfoWithClassHierarchy.java:818)
    at com.android.tools.r8.graph.AppInfoWithClassHierarchy.resolveMethodOn(AppInfoWithClassHierarchy.java:808)
    at com.android.tools.r8.tracereferences.Tracer$UseCollector.lambda$registerSuperType$1(Tracer.java:278)
    at com.android.tools.r8.graph.MethodCollection.lambda$forEachMethodMatching$0(MethodCollection.java:134)
    at com.android.tools.r8.graph.MethodCollectionBacking.lambda$forEachMethod$0(MethodCollectionBacking.java:60)
    at com.android.tools.r8.graph.MethodArrayBacking.traverse(MethodArrayBacking.java:76)
    at com.android.tools.r8.graph.MethodCollectionBacking.forEachMethod(MethodCollectionBacking.java:57)
    at com.android.tools.r8.graph.MethodCollectionBacking.forEachMethod(MethodCollectionBacking.java:53)
    at com.android.tools.r8.graph.MethodCollection.forEachMethodMatching(MethodCollection.java:131)
    at com.android.tools.r8.graph.MethodCollection.forEachMethod(MethodCollection.java:126)
    at com.android.tools.r8.graph.DexClass.forEachMethod(DexClass.java:326)
    at com.android.tools.r8.tracereferences.Tracer$UseCollector.registerSuperType(Tracer.java:274)
    at com.android.tools.r8.tracereferences.Tracer$UseCollector.access$000(Tracer.java:115)
    at com.android.tools.r8.tracereferences.Tracer.run(Tracer.java:98)
    at com.android.tools.r8.tracereferences.TraceReferences.runInternal(TraceReferences.java:80)
    at com.android.tools.r8.tracereferences.TraceReferences.lambda$run$0(TraceReferences.java:34)
    at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:80)
    ... 5 more

ninja: build stopped: subcommand failed.


Note: We don't get above errors for debug build, where proguard gets disabled. It seems it occurs when we enable proguard, but from error logs its not clear that which area I need to look into.

Sam Maier

unread,
Dec 19, 2022, 9:18:35 AM12/19/22
to kr.dee...@gmail.com, Chromium-dev, bruce...@google.com
That's a crash in R8. What I'd do first is see if a newer version of R8 still has this crash (can be done by updating the DEPS file entry to the one we are currently using, then running gclient sync). If the most current version of R8 still has this crash, you should file a bug against R8 (see instructions here on how to make a good bug report).

--
--
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 unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/47eb9197-290f-44cf-a9a6-de59268e0e46n%40chromium.org.

Deepak Kumar

unread,
Dec 20, 2022, 2:18:16 AM12/20/22
to Chromium-dev, sma...@chromium.org, Chromium-dev, bruce...@google.com, Deepak Kumar
Thanks for the response,
For sure we will try upgrading R8 to latest version, in case it doesn't work after upgrading to latest, can we try downgrading it, because on 103 build there was no such crash.

Will there be any side affect on build if we downgrade it?

Sam Maier

unread,
Dec 20, 2022, 9:31:54 AM12/20/22
to Deepak Kumar, Chromium-dev, bruce...@google.com
If it builds, it's probably OK. I don't know at which versions we made breaking changes to the usage of R8, but we are occasionally updating the usage of R8 to use new features, but that'll fail at build-time.

Deepak Kumar

unread,
Dec 21, 2022, 2:47:14 AM12/21/22
to Chromium-dev, sma...@chromium.org, Chromium-dev, bruce...@google.com, Deepak Kumar
Thanks, I have updated R8 to latest version, but unfortunately it didn't work and gave me more new build errors, but I tried to downgrade to the version which is used in chromium 103.0.5060.70 maybe the version would be  "ovozeRSDDfERnEFpDo_WS6OYOcEF7oT1JzGxCSf-g0kC", after these changes build started working and there was no crash in R8, I am testing more for any side affects but so far I didn't observe any issue.

Just to highlight the issue with r8 used in chromium 106.0.5249.65 and version "qvL35O3yU1ZbOWHVZBedmVtdaav1qKquii4RJyUh-PgC" , when we write proguard rule to keep all classes in package and sub-packages
 example -keep class com.package.**  { *; }
it breaks the build.
I know this is not a good approach to write proguard rule, but we can't manage third party SDK's proguard rule unfortunately.
Reply all
Reply to author
Forward
0 new messages