Android architecture usage?

后端 未结 4 550
既然无缘
既然无缘 2021-01-31 07:38

I have a few native libraries that are fairly big and bloating the application binary size. I looked into APK splitting but maintaining and QAing multiple APKs is not something

4条回答
  •  情书的邮戳
    2021-01-31 08:12

    I was stuck with this problem when using Mapbox, then later found this article which was very useful.

    Based on the below picture you just need armeabi-v7a and x86. Then based on Jose Gómez answer, I only added armeabi-v7a and didn't have any problem at all.

    So add this line to your app.gradle

    android {
     defaultConfig {
            //other configs
            ndk {
                abiFilters "armeabi-v7a"
            }
        }
    }
    

    If you're still worried about 2% - 3% of those who use x86 architecture, like ASUS ZenFone and lenovo phones then use this config instead in app.gradle

    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    

    Also for genymotion emulators you should use x86 architecture

    UPDATE

    If you get this error while publishing the apk in play store

    Then use this

    ndk {
        abiFilters "armeabi-v7a", "arm64-v8a"
    }
    

    And finally, I suggest you use app bundle for releasing the APK

提交回复
热议问题