title: after upgrading Android studio 3.0, dependency error occurred on externalNativeBuildRelease
body: <p>on 2.3.3, the build works well, however, after upgrading 3.0.0 this problem occurred. Is there anyone who can help me?
  The reason is that libSDL2.so is not generated, however, I don't understand why SDLActivity module start to build before SDL2-android-studio completes to build.</p>
  
  <p>I think that SDLActivity module start to build after the build job for SDL2-android-studio module completes. In fact, on 2.3.3, it worked. But, on 3.0.0, it doesn't. That is, on 2.3.3 the task externaNativeBuildRelease of SDLActivity starts after that of SDL-android-studio completed. on 3.0.0, after the task transformClassesAndResourcesWithPrepareIntermediateJasrForDebug of SDL-android-stduio-studio, all of SDLActivity are processed.
  How to control the dependency between the tasks?</p>
  
  <p>Thanks in advance.</p>
  
  <h2>build.gradle for SDL2 module is like the following.</h2>
  
  <pre><code>apply plugin: 'com.android.library' 
  
  android 
  {
      compileSdkVersion 26
      buildToolsVersion '26.0.2'
  
      defaultConfig {
          minSdkVersion 21
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
  
          ndk {
              abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
          }
          externalNativeBuild {
              cmake {
                  arguments '-DANDROID_TOOLCHAIN=clang'
              }
  
          }
      }
  
      externalNativeBuild {
          cmake {
              path 'android-cmake/CMakeLists.txt'
          }
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'),
                      'proguard-rules.pro'
          }
          debug {
              jniDebuggable true
          }
      }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
  }
  </code></pre>
  
  <h2>And, build.gradle for SDLActivity is like the following.</h2>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 26
      buildToolsVersion '26.0.2'
  
      defaultConfig {
          minSdkVersion 21
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
  
          ndk {
              abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
          }
          externalNativeBuild {
              cmake {
                  arguments '-DANDROID_TOOLCHAIN=clang',
                          '-DANDROID_PLATFORM=android-21'
                  cppFlags "-std=c++11"
              }
  
          }
      }
  
      externalNativeBuild {
          cmake {
              path 'CMakeLists.txt'
          }
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
          debug {
              jniDebuggable true
          }
      }
  
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:26.+'
      androidTestCompile 'junit:junit:4.12'
      testCompile 'junit:junit:4.12'
      compile project(':SDL2-android-studio')
      compile project(':libtciplayer')
      compile project(':TciSdk')
      compile project(':soundtouch')
  }
  </code></pre>
  
  <h2>on 3.0.0, the build failed</h2>
  
  <p>Executing tasks: [:SDLActivity:generateReleaseSources, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]</p>
  
  <p>...</p>
  
  <p>:SDLActivity:preReleaseUnitTestBuild UP-TO-DATE
  :SDLActivity:javaPreCompileReleaseUnitTest
  :SDLActivity:compileReleaseUnitTestJavaWithJavac
  :SDLActivity:processReleaseJavaRes NO-SOURCE
  :SDLActivity:processReleaseUnitTestJavaRes NO-SOURCE
  :SDLActivity:compileReleaseUnitTestSources
  :SDLActivity:generateJsonModelRelease
  :SDLActivity:externalNativeBuildRelease
  Build main arm64-v8a
  ninja: error: '../../../../../distribution/SDL2/lib/arm64-v8a/libSDL2.so', needed by 'D:/corelab_proj/GearToTciPlayer2/distribution/main/lib/arm64-v8a/libmain.so', missing and no known rule to make it
  :SDLActivity:externalNativeBuildRelease FAILED</p>
  
  <p>FAILURE: Build failed with an exception.</p>
  
  <ul>
  <li><p>What went wrong:
  Execution failed for task ':SDLActivity:externalNativeBuildRelease'.</p>
  
  <blockquote>
    <p>Build command failed.
    Error while executing process D:\User-expansion\Android\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\corelab_proj\GearToTciPlayer2\SDLActivity.externalNativeBuild\cmake\release\arm64-v8a --target main}
    ninja: error: '../../../../../distribution/SDL2/lib/arm64-v8a/libSDL2.so', needed by 'D:/corelab_proj/GearToTciPlayer2/distribution/main/lib/arm64-v8a/libmain.so', missing and no known rule to make it</p>
  </blockquote></li>
  <li><p>Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.</p></li>
  <li><p>Get more help at <a href="https://help.gradle.org" rel="nofollow noreferrer">https://help.gradle.org</a></p></li>
  </ul>
  
  <p>BUILD FAILED in 13s</p>
  
  <p>69 actionable tasks: 19 executed, 50 up-to-date</p>
  
  <h2>But, on 2.3.3, the build is successful</h2>
  
  <p>Executing tasks: [:SDLActivity:generateReleaseSources, :SDLActivity:prepareReleaseUnitTestDependencies, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]</p>
  
  <p>Configuration on demand is an incubating feature.
  The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
  The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
  The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
  :SDL2-android-studio:preBuild UP-TO-DATE
  :SDL2-android-studio:preReleaseBuild UP-TO-DATE
  :SDL2-android-studio:checkReleaseManifest
  :SDL2-android-studio:prepareReleaseDependencies
  :SDL2-android-studio:compileReleaseAidl UP-TO-DATE
  :SDL2-android-studio:compileLint UP-TO-DATE
  :SDL2-android-studio:copyReleaseLint NO-SOURCE
  :SDL2-android-studio:mergeReleaseShaders UP-TO-DATE
  :SDL2-android-studio:compileReleaseShaders UP-TO-DATE
  :SDL2-android-studio:generateReleaseAssets UP-TO-DATE
  :SDL2-android-studio:mergeReleaseAssets UP-TO-DATE
  :SDL2-android-studio:mergeReleaseProguardFiles UP-TO-DATE
  :SDL2-android-studio:packageReleaseRenderscript NO-SOURCE
  :SDL2-android-studio:compileReleaseRenderscript UP-TO-DATE
  :SDL2-android-studio:generateReleaseResValues UP-TO-DATE
  :SDL2-android-studio:generateReleaseResources UP-TO-DATE
  :SDL2-android-studio:packageReleaseResources UP-TO-DATE
  :SDL2-android-studio:processReleaseManifest UP-TO-DATE
  :SDL2-android-studio:generateReleaseBuildConfig UP-TO-DATE
  :SDL2-android-studio:processReleaseResources UP-TO-DATE
  :SDL2-android-studio:generateReleaseSources UP-TO-DATE
  :SDL2-android-studio:incrementalReleaseJavaCompilationSafeguard
  :SDL2-android-studio:javaPreCompileRelease
  :SDL2-android-studio:compileReleaseJavaWithJavac
  :SDL2-android-studio:processReleaseJavaRes NO-SOURCE
  :SDL2-android-studio:transformResourcesWithMergeJavaResForRelease
  :SDL2-android-studio:transformClassesAndResourcesWithSyncLibJarsForRelease
  :SDL2-android-studio:generateJsonModelRelease
  :SDL2-android-studio:externalNativeBuildRelease
  Build SDL2 arm64-v8a
  [1/114] Building C object CMakeFiles/SDL2.dir/D_/corelab_proj/GearToTciPlayer2/SDL2-android-studio/src/SDL_log.c.o
  ...
  [114/114] Linking C shared library D:\corelab_proj\GearToTciPlayer2\dis
  tribution\SDL2\lib\arm64-v8a\libSDL2.so
  Build SDL2 x86
  [1/114] Building C object 
  ...
  [114/114] Linking C shared library D:\corelab_pr
  oj\GearToTciPlayer2\distribution\SDL2\lib\x86\libSDL2.so
  Build SDL2 armeabi-v7a
  [1/114] Building C object CMakeFiles/SDL2.dir/D_/corelab_proj/GearToTciPlayer2/SDL2-android-studio/src/dynapi/SDL_dynapi.c.o
  ...
  [114/114] Linking C shared library D:\corelab_proj\GearToTciPlayer2\distribution\SDL2\lib\armeabi-v7a\libSDL2.so
  :SDL2-android-studio:mergeReleaseJniLibFolders
  :SDL2-android-studio:transformNativeLibsWithMergeJniLibsForRelease
  :SDL2-android-studio:transformNativeLibsWithStripDebugSymbolForRelease
  :SDL2-android-studio:transformNativeLibsWithSyncJniLibsForRelease
  :SDL2-android-studio:bundleRelease
  :SDLActivity:preBuild UP-TO-DATE
  :SDLActivity:preReleaseBuild UP-TO-DATE
  :SDLActivity:checkReleaseManifest
  :SDLActivity:preDebugAndroidTestBuild UP-TO-DATE
  :SDLActivity:preDebugBuild UP-TO-DATE
  :SDLActivity:preDebugUnitTestBuild UP-TO-DATE
  :SDLActivity:preReleaseUnitTestBuild UP-TO-DATE
  :SDLActivity:prepareAndroidArchLifecycleRuntime100Library
  :SDLActivity:prepareComAndroidSupportAnimatedVectorDrawable2610Library
  :SDLActivity:prepareComAndroidSupportAppcompatV72610Library
  :SDLActivity:prepareComAndroidSupportSupportCompat2610Library
  :SDLActivity:prepareComAndroidSupportSupportCoreUi2610Library
  :SDLActivity:prepareComAndroidSupportSupportCoreUtils2610Library
  :SDLActivity:prepareComAndroidSupportSupportFragment2610Library
  :SDLActivity:prepareComAndroidSupportSupportMediaCompat2610Library
  :SDLActivity:prepareComAndroidSupportSupportV42610Library
  :SDLActivity:prepareComAndroidSupportSupportVectorDrawable2610Library
  :SDLActivity:prepareReleaseDependencies
  :SDLActivity:compileReleaseAidl UP-TO-DATE
  :SDLActivity:compileReleaseRenderscript UP-TO-DATE
  :SDLActivity:generateReleaseBuildConfig UP-TO-DATE
  :SDLActivity:generateReleaseResValues UP-TO-DATE
  :SDLActivity:generateReleaseResources UP-TO-DATE
  :SDLActivity:mergeReleaseResources UP-TO-DATE
  :SDLActivity:processReleaseManifest UP-TO-DATE
  :SDLActivity:processReleaseResources
  :SDLActivity:generateReleaseSources
  :SDLActivity:prepareReleaseUnitTestDependencies
  :SDLActivity:mockableAndroidJar UP-TO-DATE
  :SDLActivity:incrementalReleaseJavaCompilationSafeguard
  :SDLActivity:javaPreCompileRelease
  :SDLActivity:compileReleaseJavaWithJavac
  Note: Some input files use or override a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.</p>
  
  <p>:SDLActivity:incrementalReleaseUnitTestJavaCompilationSafeguard NO-SOURCE
  :SDLActivity:javaPreCompileReleaseUnitTest
  :SDLActivity:compileReleaseUnitTestJavaWithJavac
  :SDLActivity:processReleaseJavaRes NO-SOURCE
  :SDLActivity:processReleaseUnitTestJavaRes NO-SOURCE
  :SDLActivity:compileReleaseUnitTestSources
  :SDLActivity:generateJsonModelRelease
  :SDLActivity:externalNativeBuildRelease
  [1/10] Building CXX object CMakeFiles/main.dir/src/cpp/SDLAudioImpl.cpp.o
  ...
  [10/10] Linking CXX shar
  ed library D:\corelab_proj\GearToTciPlayer2\dist
  ribution\main\lib\armeabi-v7a\libmain.so
  :SDLActivity:compileReleaseSources</p>
  
  <p>BUILD SUCCESSFUL in 1m 38s
  133 actionable tasks: 77 executed, 56 up-to-date</p>