title: How to include shared libraries in android studio project?
body: <p>I am trying to use the <a href="https://github.com/artoolkit/artoolkit5" rel="nofollow noreferrer">ARToolKit</a> library in an android studio project. This library uses an NDK shared library, so i have followed <a href="https://developer.android.com/ndk/guides/prebuilts.html" rel="nofollow noreferrer">this</a> guide to include it in my project. I have also tried solutions from <a href="https://stackoverflow.com/questions/27421134/system-loadlibrary-couldnt-find-native-library-in-my-case">this</a> question.</p>
  
  <p>I don't think this issue is specific to the ARToolKit library but rather that I misunderstand the NDK shared library usage.</p>
  
  <p>My Android.mk file for the shared library module looks like this (following the question referenced above):</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  LOCAL_MODULE    := artoolkit
  LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libc++_shared.so
  include $(PREBUILT_SHARED_LIBRARY)
  </code></pre>
  
  <p>Or like this, respectively (following the guide mentioned above):</p>
  
  <pre><code>LOCAL_PATH := /Users/balance/SDKs/ARToolKit5
  
  include $(CLEAR_VARS)
  LOCAL_MODULE := artoolkit
  LOCAL_SRC_FILES := android/libs/$(TARGET_ARCH_ABI)/libc++_shared.so
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
  include $(PREBUILT_SHARED_LIBRARY)
  </code></pre>
  
  <p>And for the .aar module:</p>
  
  <pre><code>include $(CLEAR_VARS)
  LOCAL_MODULE := aRBaseLib-release
  LOCAL_SHARED_LIBRARIES := artoolkit
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>I have added the shared library module as a dependency to the .aar module, resulting in this code in aRBaseLib-release:</p>
  
  <pre><code>configurations.maybeCreate("default")
  artifacts.add("default", file('aRBaseLib-release.aar'))
  dependencies {
      implementation project(':artoolkit')
  }
  </code></pre>
  
  <p>But when trying to build the project i get the following error:</p>
  
  <pre><code>Gradle sync failed: Could not find method implementation() for arguments [project ':artoolkit'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
  </code></pre>
  
  <p>I realise these snippets may not be all that helpful, so I am of course ready to start over with your guidance and to post new error messages from there.</p>
  
  <p>Any ideas will be appreciated and tried out.</p>