title: Unable to find native libraries after switching to Android App Bundles
body: <p>After switching to Android App Bundle, my installed app was unable to find native libraries even though <code>.aab</code> file contains them. I found that I have encountered the same issue as described in this question: <a href="https://stackoverflow.com/questions/62807988">Android App Bundle (only) - native library failed to load</a></p>
  <p>And, the answer to that question suggests to use following Gradle property. This solves my issue.</p>
  <blockquote>
  <p>android.bundle.enableUncompressedNativeLibs = false</p>
  </blockquote>
  <p>But, Gradle 7.0+ introduces this change in the name of optimization.
  What are the implications of avoiding this? How can I support it?</p>
  <hr />
  <p>Here's how I add and find <code>.so</code> libraries in my app. I cannot use <code>System.loadLibrary(...)</code> at the moment.</p>
  <p>I have added <code>libcore.so</code> file to <code>:core</code> module like this:</p>
  <pre><code>core / libs / arm64-v8a    / libcore.so
  core / libs / armeabi-v7a  / libcore.so
  core / libs / x86          / libcore.so
  core / libs / x86_64       / libcore.so
  </code></pre>
  <p>And, in <code>AndroidManifest.xml</code>, I have added following line:</p>
  <pre><code>android:extractNativeLibs=&quot;true&quot;
  </code></pre>
  <p>And, in <code>build.gradle</code> of <code>:core</code> module, I have added <code>sourceSets</code> like this:</p>
  <pre><code>android {
      sourceSets.main {
          assets.srcDirs = ['assets']
          jniLibs.srcDirs = ['libs']
      }
  }
  </code></pre>
  <p>I ensure the native library is available like this:</p>
  <pre><code>private fun ensureNativeLibAvailable(context: Context, fileName: String) {
      val nativeDir = File(context.applicationInfo.nativeLibraryDir)
      findFile(fileName, nativeDir) 
          ?: throw RuntimeException(&quot;$fileName not found.&quot;) 
  }
  </code></pre>
  <p>Here, <code>findFile(...)</code> function searches for <code>libcore.so</code> file in <code>~~~/lib/arm64/</code> folder for <code>arm64-v8a</code> devices.</p>
  <p>After building <code>.apk</code> format, I am able to find <code>libcore.so</code> using above code. <code>/data/data/package-name</code> path has a folder with <code>lib-main</code> name. It contains following files:</p>
  <pre><code>dso_deps
  dso_lock
  dso_manifest
  dso_state
  </code></pre>
  <hr />
  <p>If I build <code>.aab</code> file instead, without using the fix from linked answer, this code fails. <code>/data/data/package-name</code> contains four new folders. <code>lib-0</code> contains <code>libcore.so</code>. <code>lib-1</code>, <code>lib-2</code>, <code>lib-main</code> are, also, present. <code>dso</code> files are present in all <code>lib-*</code> folders.</p>