title: Error when building project with NDK support after updating to Android Studio 4.0 from 3.6
body: <p>After updating Android Studio to 4.0 project build finishes with error</p>
  
  <blockquote>
    <p>More than one file was found with OS independent path 'lib/armeabi-v7a/libdlib.so'. If you are using jniLibs and CMake IMPORTED targets, see <a href="https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake" rel="noreferrer">https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake</a></p>
  </blockquote>
  
  <p>The link leads to the page with <em>New features in Android Studio Preview</em> which is 4.1</p>
  
  <p><strong>EDIT</strong>
  Actually you can find information that is linked in Google cache:
  <a href="https://webcache.googleusercontent.com/search?q=cache%3AEmPbYyXx-NgJ%3Ahttps%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fpreview%2Ffeatures%3Fhl%3Dru%20&amp;cd=1&amp;hl=uk&amp;ct=clnk&amp;gl=ua&amp;buildsystem=ndk-build#automatic_packaging_of_prebuilt_dependencies_used_by_cmake" rel="noreferrer">Automatic packaging of prebuilt dependencies used by CMake</a>
  What is stated there is:</p>
  
  <blockquote>
    <p>Prior versions of the Android Gradle Plugin required that you explicitly package any prebuilt libraries used by your CMake external native build by using jniLibs. With Android Gradle Plugin 4.0, the above configuration is no longer necessary and will result in a build failure:</p>
  </blockquote>
  
  <p>But it is not the case for me</p>
  
  <p>Here are <code>build.gradle</code></p>
  
  <pre><code>apply plugin: 'com.android.library'
  apply plugin: 'kotlin-android'
  android {
  compileSdkVersion 29
  buildToolsVersion "29.0.2"
  
  
  defaultConfig {
      minSdkVersion 21
      targetSdkVersion 29
      versionCode 1
      versionName "1.0"
  
      externalNativeBuild {
          cmake {
              cFlags "-O3"
              cppFlags "-std=c++11 -frtti -fexceptions -mfpu=neon"
              arguments "-DANDROID_PLATFORM=android-16",
                      "-DANDROID_TOOLCHAIN=clang",
                      "-DANDROID_STL=c++_shared",
                      "-DANDROID_ARM_NEON=TRUE",
                      "-DANDROID_CPP_FEATURES=rtti exceptions"
          }
      }
  }
  
  buildTypes {
      debug {}
      stage {
          debuggable true
          minifyEnabled false
      }
  
      release {
          minifyEnabled false
      }
  }
  
  kotlinOptions {
      jvmTarget = "1.8"
  }
  
  externalNativeBuild {
      cmake {
          path "src/main/cpp/CMakeLists.txt"
          version "3.10.2"
      }
  }
  
  packagingOptions {
      pickFirst "**/libc++_shared.so"
      pickFirst "**/libdlib.so"
  }
  
  }
  
  dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
  
     implementation 'androidx.annotation:annotation:1.1.0'
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  }
  </code></pre>
  
  <p>and <code>CMakeLists.txt</code></p>
  
  <pre><code>set(LIB_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs)
  
  #
  cmake_minimum_required(VERSION 3.4.1)
  
  add_library(dlib SHARED IMPORTED)
  
  # sets the location of the prebuilt dlib .so
  set_target_properties( dlib
          PROPERTIES IMPORTED_LOCATION
          ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libdlib.so )
  
  # ------------------------------------------------------------------
  
  add_library( # Sets the name of the library.
          face-lib
  
          # Sets the library as a shared library.
          SHARED
  
          # Provides a relative path to your source file(s).
          face-lib.cpp)
  
  target_include_directories(
          face-lib PRIVATE
          ${CMAKE_SOURCE_DIR}/include
  )
  
  find_library( # Sets the name of the path variable.
          log-lib
  
          # Specifies the name of the NDK library that
          # you want CMake to locate.
          log)
  
  
  target_link_libraries( # Specifies the target library.
          face-lib
  
          dlib
  
          # Links the target library to the log library
          # included in the NDK.
          ${log-lib})
  </code></pre>