How to add pre-created * .so library in android studio 2.2

I tried to add the library to the project, but android studio ignores my library. My CmakeLists.txt add_library( mylib SHARED IMPORTED ) set_target_properties(ffmpeg PROPERTIES IMPORTED_LOCATION src/main /libs/${ANDROID_ABI}/libmylib.so )

After creating my apk there will be no libmylib.so. How to add a pre-created library to a project using cmake?

+4
source share
2 answers

it is currently necessary to pack it into the application. it could be something like:

    sourceSets {
        main {
            // let gradle pack the shared library into apk
            jniLibs.srcDirs = ['point/to/your/shared-lib']
       }
    }

: https://github.com/googlesamples/android-ndk/blob/master/hello-libs/app/build.gradle lib [ ] , CMakeLists.txt.

: https://code.google.com/p/android/issues/detail?id=214664&can=8&q=vulkan&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened

+7

1 - :/libs, .

2 -

yourprojectname/
      app/
           - build.gradle  // Local Gradle configuration (for app only)
           ...
      libs/
           libraryName/
                - build.gradle // Local Gradle configuration (for library only)
      - build.gradle // Global Gradle configuration (for whole project)
      - settings.gradle
      - gradle.properties
      ...

3 - gradle.setting to

include ':app', ':libraryName'
project(':libraryName').projectDir = new File('libs/libraryName')

4-In app/build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(":PagerSlidingTabStrip")
}

android , gradle , :

1./ /

2. , Dependancy

+2

Source: https://habr.com/ru/post/1658370/


All Articles