2

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.

Anthony
  • 7,638
  • 3
  • 38
  • 71
  • Maybe post some error output and a little more context? – dcow Mar 14 '16 at 20:35
  • Updated, figured I was just missing some means to insert an array so I was overly brief. – Anthony Mar 15 '16 at 00:29
  • Are your projects actually called `libraw` and `libjpeg` or just `raw` and `jpeg`? – dcow Mar 15 '16 at 01:57
  • Yes, those are the names of the modules, exactly as defined in settings.gradle. – Anthony Mar 15 '16 at 10:24
  • Needed to work on another pc today and decided to just exhaustively recreate the project and I successfully built. Obviously a typo somewhere, I'll update when I have a chance to diff the two installs. – Anthony Mar 15 '16 at 16:59
  • How have you achieved configuring separate native libraries that generate separate .so archives? – Alejandro Zurcher Apr 01 '16 at 18:13
  • Negative, spent another day on it then moved on...tried tons of things, static/shared, simplified as much as I could. It might be worthwhile building a boilerplate project to see if it can work at all. – Anthony Apr 01 '16 at 18:23

0 Answers0