Including external jniLibs with experimental grade plugin

閲覧: 159 回
最初の未読メッセージにスキップ

Gary Bak

未読、
2015/10/08 13:25:452015/10/08
To: android-ndk
I'm attempting to use AndroidStudio with the experimental 0.2.0 plugin to edit a few C sources in our large NDK project.  Iv'e hacked up a small project that includes only the sources I need to edit and all the headers it depends on.  With a creative set of CFlags, ldFlags and ldLibs, Iv'e managed to get the project to compile.  

The problem I have is adding the .so files that are built from another project to the apk.  I've created a job that copies the shared objects to the local jniLibs directory, but they are never included in the apk.  I've managed to include them by copying them into the intermediate gradle directory, but that hack does not survive a clean build.

I've tried the directories src/main/lib, src/main/libs and src/main/jniLibs.  Defining a jniLibs srcDir seems to have no affect.

model {
  android.sources {
        main.jni.source.srcDir 'src/main/config'
        main.jni.source.srcDir '../../../../drivers/audio/android'
        main.jni.source.srcDir '../../../../drivers/audio/android/incl'
        main.jni.source.srcDir '../../../../common/incl'
        main.jni.source.srcDir '../../../../common/clib/incl'
        main.jni.source.srcDir '../../../../common/utils/incl'
        
        main.jniLibs.source.srcDir '../../../../libs'
  }
}

Is there any way of including external libraries with the experimental plugin?





Gary Bak

未読、
2015/10/09 13:12:252015/10/09
To: android-ndk
Adding in my own copy seems to be my only solution for now:

task copyLibs(type: Copy) {
    def source = file("" + projectDir + File.separator + "/../../../../path/to/project/src/main/obj/local/armeabi-v7a").toPath().normalize()
    from source.toString()
    include "*.so"
    exclude "libSomeFile.so"
    into 'build/intermediates/binaries/debug/arm/lib/armeabi-v7a'
}
tasks.whenTaskAdded { currentTask ->
    if ( currentTask.name == "preDexArmDebug") {
        currentTask.dependsOn copyLibs
全員に返信
投稿者に返信
転送
新着メール 0 件