2017-07-09 3 views
1

私のアプリでは、ネイティブライブラリのセットを使用しています。これらのライブラリは、さまざまなCPUアーキテクチャで使用できます。しかし問題は、それらの図書館がapkサイズのほぼ87%を占めていることです。アンドロイドのCPUアーキテクチャに基づいて条件付きでネイティブライブラリをロードする方法

enter image description here

enter image description here

私はので、私はCPUアーキテクチャをベースと条件付きのapkを作りたい、ダウンロードするためのAPKのサイズを小さくしたいです。どうしたらいいですか?

+1

私の知る限り、あなたはあなたのアプリケーション内の各 'cpu'に異なる' flavour'を作成し、各 'flavour'のために必要なライブラリを使用する必要があります。これはあなたに複数の出力 'apk'ファイルを与えます。 – Merka

答えて

2

AbiSplitOptionsを使用してください。

例:

android { 
    ... 
    splits { 

    // Configures multiple APKs based on ABI. 
    abi { 

    // Enables building multiple APKs. 
    enable true 

    // By default all ABIs are included, so use reset() and include to specify that we only 
    // want APKs for x86, armeabi-v7a, and mips. 
    reset() 

    // Specifies a list of ABIs that Gradle should create APKs for. 
    include "x86", "armeabi-v7a", "mips" 

    // Specify that we want to also generate a universal APK that includes all ABIs. 
    universalApk true 
    } 
    } 
} 
+2

Google PlayストアでAPKを配信する場合、各分割の** versionCode **に注意してください。幸いにも、これは公式サイトの(https://developer.android.com/studio/build/configure-apk-splits.html#configure-APK-versions)によく記述されています。 –

関連する問題