2

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.

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?

Thanks in advance.

build.gradle for SDL2 module is like the following.

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')
}

And, build.gradle for SDLActivity is like the following.

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')
}

on 3.0.0, the build failed

Executing tasks: [:SDLActivity:generateReleaseSources, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]

...

: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

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':SDLActivity:externalNativeBuildRelease'.

    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

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s

69 actionable tasks: 19 executed, 50 up-to-date

But, on 2.3.3, the build is successful

Executing tasks: [:SDLActivity:generateReleaseSources, :SDLActivity:prepareReleaseUnitTestDependencies, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]

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.

: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

BUILD SUCCESSFUL in 1m 38s 133 actionable tasks: 77 executed, 56 up-to-date

moony
  • 61
  • 5

1 Answers1

3

I solved this problem referencing this, https://github.com/googlesamples/android-ndk/issues/450

moony
  • 61
  • 5