TitleHow to solve the error on building an Android project on Unity with SDK v4.2022-07-29 17:44:32
Writer

When building an Android project on Unity after upgrading Hive SDK v4, the cause and solution of the error are as follows.

[Case 1]
Android build includes the frameworks and resources for iOS build.

  • Error message
    Exception: Unknown CPU architecture for library Assets/Hive_SDK_v4/Plugins/iOS/framework/libSingular.a
  • Solution
    1. Change the settings for the folders under Assets/Hive_SDK_v4/Plugins/iOS/framework/ to tick iOS only except Headers.
    2. Change the settings for all folders under Assets/Hive_SDK_v4/Plugins/iOS/resource/ to tick iOS only.
    3. Build the project again.
  • [Case 2]
    The maxSdkVersion value from WRITE_EXTERNAL_STORAGE permission of Hive SDK v4 and that of Vungle are mismatched.

    • Error message
      Execution failed for task ‘:processReleaseManifest’.
      > Manifest merger failed : Attribute uses-permission#android.permission.WRITE_EXTERNAL_STORAGE@maxSdkVersion value=(18) from [com.vungle:publisher-s
      dk-android:6.4.11] AndroidManifest.xml:16:9-35
      is also present at [:HIVE_SDK:] AndroidManifest.xml:18:9-35 value=(22).
      Suggestion: add ‘tools:replace=”android:maxSdkVersion”‘ to <uses-permission> element at AndroidManifest.xml:34:3-79 to override.

  • Solution
    1. Add the following to /Assets/Plugins/Android/Androidmanifest.xml file.
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" tools:replace="android:maxSdkVersion" />
    2. Build the project again.