Android native dependencies

喜你入骨 提交于 2019-12-11 03:05:24

问题


Supposedly we can now define dependencies on native-only libraries, but I'm having an issue adding multiple dependencies.

apply plugin: 'com.android.model.library'

model {
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"

        defaultConfig {
            minSdkVersion.apiLevel 11
            targetSdkVersion.apiLevel 22
            versionCode = 1
            versionName = "1.0"
        }

        sources {
            //noinspection GroovyAssignabilityCheck
            main {
                jni {
                    dependencies {
                        project ":libraw"
                        project ":libjpeg"
                    }
                }
            }
        }

        ndk {
            moduleName "rawprocessor"
            cppFlags.add("-fexceptions")
            ldLibs.add("log")
            stl "gnustl_shared"
        }
    }
}

The two libraries are com.android.model.native and they generate an .so properly.

Headers are loaded from foo, but not bar. If I swap the lines they'll load from bar but not foo. Is there a way to load multiple dependencies?

Update (Actual error messages, complete build.gradle added)

undefined reference to 'jpeg_std_error'
undefined reference to 'jpeg_CreateDecompress' 
undefined reference to 'jpeg_mem_src' 

These continue for any reference to libjpeg in the aggregate library. If I swap libjpeg to be first I get the same undefined reference to any call in the other library.

undefined reference to `open_file(char const*, long long)'
undefined reference to `recycle()'

Update 2

I just noticed that when I add the aggregate library module (the above build.gradle), the build process does not build the second library. If I comment out that library it builds both native-only libraries. I'm now starting to wonder if there's some issue due to the fact that libraw also depends on libjpeg.

来源:https://stackoverflow.com/questions/35964577/android-native-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!