Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2020.3.X, 2021.1.X

Votes

14

Found in

2020.2.0a12

2020.2.3f1

2021.1

2021.2

Issue ID

1314472

Regression

Yes

[Android] App installed using APK from app bundle option in Android Studio fails to run

Android

-

How to reproduce:
1. Create and open a new project
2. Open Build Settings and switch to the Android platform
3. Add Open Scenes to build
4. Check the "Export Project" checkbox
5. Click Export and select directory to export project to
6. Open the exported project using Android Studio
7. Click Build > Build Bundles(s) / APK(s) > Build Bundle(s)
8. Open Run > Edit Configurations... > launcher > General > Installation Options
9. Set "Deploy" to "APK from app bundle"
10. Click Run -> Run 'launcher'

Expected Behavior: app launches in the connected device
Actual Behavior: error message appears: "The full error message: Failure to initialize! Your hardware does not support this application. Failed to load 'libmain.so' java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/com.DefaultCompany.bugexportproject-9BuOMuJaMXjG4oK6dLN3SQ==/lib/arm/libmain.so" not found Press Ok to quit."

Reproducible with: 2020.2.0a12, 2020.2.7f1, 2021.1.0b11, 2021.2.0a8
Not reproducible with: 2018.4.32f, 2019.4.21f1, 2020.2.0a11

Reproducible devices:
VLNQA00335, Samsung Galaxy S20+ 5G (SM-G986B), Android 10, CPU: Exynos 990, GPU: Mali-G77
Pixel4a (customer information)

Not reproducible devices:
VLNQA00286, Meizu - (PRO 5), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760
VLNQA00313, Huawei Y6 Ⅱ Compact (HUAWEI LYO-L01), Android 5.1, CPU: MediaTek MT6735, GPU: Mali-T720

  1. Resolution Note (fix version 2021.2):

    Fixed in 2021.2.0a11

  2. Resolution Note (fix version 2021.1):

    Fixed in 2021.1.2f1

  3. Resolution Note (fix version 2020.3):

    Fixed in: 2020.3.3f1

Comments (12)

  1. forofonof

    Aug 08, 2024 12:03

    Unity 2022.3.41f / 2022.3.40f

    I’m confirming that the following error persists:
    "failed to load libmain.so"

    I tried adding the following lines at the end:

    android.bundle.enableUncompressedNativeLibs=false
    android:extractNativeLibs="true"

    Unfortunately, it didn't help. The issue remains unresolved. Still searching for a solution. Wish me luck!

  2. mcwind168

    Jul 03, 2021 02:47

    Same error on Unity 2020.3.12f1c1 LTS.
    Adding android:extractNativeLibs="true" to the element in AndroidManifest.xm
    or
    Adding android.bundle.enableUncompressedNativeLibs=false to gradle properties
    won't walk around

  3. GandhiOfTheFoG

    May 21, 2021 15:16

    Still having this problem in Unity 2020.3.2f1, I'm using the Play Asset Delivery and its plugin to generate the build, which can be seen at "developer.android.com" (not a verified link apparently)

  4. gingersdas34

    Apr 16, 2021 07:21

    I don't think using a custom gradle property template would work

  5. HASSANHR

    Apr 14, 2021 18:54

    it is mentioned the the bug/error is fixed in unity 2021.1.2f1 I'm facing the exact same issue in this exact version !

  6. SRG-Team

    Mar 30, 2021 15:18

    Apologies, didnt realize my link wouldnt work. These are the lines I commented to work around the issue:

    // Android Resolver Exclusions Start
    android {
    packagingOptions {
    /*exclude ('/lib/arm64-v8a/*' + '*')
    exclude ('/lib/armeabi/*' + '*')
    exclude ('/lib/mips/*' + '*')
    exclude ('/lib/mips64/*' + '*')
    exclude ('/lib/x86/*' + '*')
    exclude ('/lib/x86_64/*' + '*')*/
    }
    }

  7. SRG-Team

    Mar 30, 2021 15:16

    This is also happening on Unity 2019.4.17f1

    Workaround is commenting out the following exclusions on the mainTemplate.gradle file:

    These exclusions uncomment themselves after building, but it works.

  8. eVPublishing

    Mar 23, 2021 15:43

    Currently we can't upvote this because it is marked as "fixed", but I'm clearly experiencing this in 2020.3.0f1.

  9. epicoro

    Mar 22, 2021 17:19

    Temp workaround:

    Build APK instead of App Bundle.

  10. unity_cwGdSCczCn3Frw

    Mar 15, 2021 10:34

    Repeating what I said here (https://forum.unity.com/threads/app-not-working-on-some-devices-failed-to-load-libmain-so.1031137/?gq=libmain.so), in case it's useful for some people:

    This is still an issue with 2020.3.0f1 (also the gradle.properties workaround is not working in my Flutter project either).

    EDIT:

    Actually adding android:extractNativeLibs="true" to the element in AndroidManifest.xml as a temporary workaround does work with 2020.3.0f1. This might be specific to my version of Gradle (per | Android Developers, this is set to false by default in Android Gradle plugin 3.6.0).

    This isn't a long-term solution as Unity should be able to handle loading native libraries without extracting to the filesystem first.

    I also confirm this is still present in 2021.1.0b11

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.