All Products
Search
Document Center

Mobile Platform as a Service:Solve conflict with dependency on wire/okio

Last Updated:Sep 16, 2022

Conflict description

As mPaaS uses wire/okio for RPC network connection, and okhttp also needs to reference okio, so when you use mPaaS with okhttp, then there may be a wire/okio conflict.

Solution

10.1.68 Baseline

Remove wire/okio dependencies of mPaaS, and regression tested the mobile gateway function to ensure it works correctly. The operation steps are as follows:

  1. Confirm the version of wire/okio used by mPaaS.

    'com.squareup.okio:okio:1.7.0@jar'
    'com.squareup.wire:wire-lite-runtime:1.5.3.4@jar'
  2. Get the group:artifact information for the mPaaS third-party SDK.

    'com.alipay.android.phone.thirdparty:wire-build'
  3. Remove the mPaaS library.

    • AAR method

      If you are using the native AAR method to access mPaaS, the dependency passing of gradle will automatically use a later version and there is no need to actively remove it. In general, the version chosen for use by mPaaS is highly stable and secure, and we recommend you to use the version provided by mPaaS. If versions are inconsistent, please test the mPaaS function before its launch to ensure stability.

    • mPaaS Inside and Portal&Bundle

      mpaascomponents {
      excludeDependencies = ["com.alipay.android.phone.thirdparty:wire-build"]
      }
  4. Add back wire or okio (use wire/okio of public network. The native AAR access method is not a concern).

    As mPaaS writes dependency of both wire and okio in the com.alipay.android.phone.thirdparty:wire-build library, you need to add them back optionally, as the case may be.

    • If there is only an okio conflict, but not a wire conflict, you need to add back the wire.

      implementation 'com.squareup.wire:wire-lite-runtime:1.5.3.4@jar'
    • If there is only a wire conflict, but not an okio conflict, you need to add back the okio.

      'com.squareup.okio:okio:1.7.0@jar'

10.2.3 Baseline

Completely remove the version dependency of mPaaS and use the version required by the business itself. To resolve the wire/okio conflict, the operation steps are as follows:

  1. Remove wire in mPaaS. Currently, mPaaS does not strongly rely on wire for now.

    • The following operations are required in the native AAR project:

      configurations {
      	all*.exclude group: 'com.alipay.android.phone.thirdparty', module: 'wire-build' 
      }
    • The following operations need to be performed in the mPaaS Inside & Component (Portal & Bundle) project:

      mpaascomponents {
              excludeDependencies = [
                      "com.alipay.android.phone.thirdparty:wire-build"
                  ]
      }
  2. The pb class of all business party rpc inherits com.squareup.wire.Message and needs to be changed to inherit com.mpaas.thirdparty.squareup.wire.Message.

    The following component functions need to be regressed: