gree / gree/unity-webview

Duplicate Class Build Errors From OnPostGenerateGradleAndroidProject

Open
#747 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C++
Stars
2.7k
Forks
734
Avg merge
11h 39m
Merged PRs (30d)
1

Description

We have a project with some complex android dependencies (we use the android resolver: https://github.com/googlesamples/unity-jar-resolver).

This includes resolving, among some other custom packages, Google AdMob, the facebook sdk, etc.

For our project this results in androidx core 1.3.2 being used however the custom resolver seems to manually add 1.6.0 as a dependency in the post gradle project built script (UnityWebViewPostprocessBuild.cs)

This results in some duplicate class errors, e.g.:

Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (:androidx.core.core-1.3.2:) and classes.jar (androidx.core:core:1.6.0)

It appears this was added recently: https://github.com/gree/unity-webview/pull/744

in order to solve this issue: https://github.com/gree/unity-webview/issues/710

Fortunately our project doesn't require the camera. A mechanism for disabling this seems helpful. We appear to be able to build and have the web view function fine by simply omitting the functionality in the OnPostGenerateGradleAndroidProject in UnityWebViewPostprocessBuild

It seems the base functionality is to enable hardware acceleration (similar to what's discussed in this unity forum thread: https://forum.unity.com/threads/android-hardwareaccelerated-is-forced-false-in-all-activities.532786/ )?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in UnityWebViewPostprocessBuild.cs at OnPostGenerateGradleAndroidProject and review the change from pull request #744 alongside issue #710. Reproduce the Android build with the resolver and inspect the duplicate androidx.core 1.3.2 and 1.6.0 dependencies. Done means the project can opt out of the added functionality without duplicate class errors while preserving the web view behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, unity
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.