在 2.3.3 上,构建运行良好,但是,在升级 3.0.0 后出现此问题。有谁能帮助我吗?原因是 libSDL2.so 没有生成,但是,我不明白为什么 SDLActivity 模块在 SDL2-android-studio 完成构建之前就开始构建。
我认为 SDLActivity 模块在 SDL2-android-studio 模块的构建作业完成后开始构建。事实上,在 2.3.3 上,它起作用了。但是,在 3.0.0 上,它没有。也就是说,在 2.3.3 上,SDLActivity 的任务 externaNativeBuildRelease 在 SDL-android-studio 的任务完成之后开始。在 3.0.0 上,在 SDL-android-stduio-studio 的任务 transformClassesAndResourcesWithPrepareIntermediateJasrForDebug 之后,处理所有的 SDLActivity。如何控制任务之间的依赖关系?
提前致谢。
SDL2 模块的 build.gradle 如下所示。
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')
}
而且,SDLActivity 的 build.gradle 如下所示。
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')
}
在 3.0.0 上,构建失败
执行任务:[:SDLActivity:generateReleaseSources, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]
...
:SDLActivity:preReleaseUnitTestBuild UP-TO-DATE :SDLActivity:javaPreCompileReleaseUnitTest :SDLActivity:compileReleaseUnitTestJavaWithJavac :SDLActivity:processReleaseJavaRes 无源 :SDLActivity:processReleaseUnitTestJavaRes 无源 :SDLActivity:compileReleaseUnitTestSources :SDLActivity:generateJsonModelRelease :SDL64-v8aninRelease:main armActivity:externalN8a错误:'../../../../../distribution/SDL2/lib/arm64-v8a/libSDL2.so','D:/corelab_proj/GearToTciPlayer2/distribution/main/lib/arm64 需要-v8a/libmain.so',缺少并且没有已知的规则可以使它:SDLActivity:externalNativeBuildRelease FAILED
FAILURE:构建失败并出现异常。
出了什么问题:任务“:SDLActivity:externalNativeBuildRelease”执行失败。
构建命令失败。使用参数执行进程 D:\User-expansion\Android\sdk\cmake\3.6.4111459\bin\cmake.exe 时出错 {--build D:\corelab_proj\GearToTciPlayer2\SDLActivity.externalNativeBuild\cmake\release\arm64-v8a --target main} ninja: 错误: '../../../../../distribution/SDL2/lib/arm64-v8a/libSDL2.so', 需要'D:/corelab_proj/GearToTciPlayer2/ distribution/main/lib/arm64-v8a/libmain.so',缺少并且没有已知的规则可以使它
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。
在https://help.gradle.org获得更多帮助
13 秒内构建失败
69 个可操作的任务:19 个已执行,50 个最新
但是,在 2.3.3 上,构建成功
执行任务:[:SDLActivity:generateReleaseSources, :SDLActivity:prepareReleaseUnitTestDependencies, :SDLActivity:mockableAndroidJar, :SDLActivity:compileReleaseUnitTestSources, :SDLActivity:compileReleaseSources]
按需配置是一项孵化功能。setTestClassesDir(File) 方法已被弃用,并计划在 Gradle 5.0 中删除。请改用 setTestClassesDirs(FileCollection) 方法。getTestClassesDir() 方法已被弃用,并计划在 Gradle 5.0 中删除。请改用 getTestClassesDirs() 方法。ConfigurableReport.setDestination(Object) 方法已被弃用,并计划在 Gradle 5.0 中删除。请改用 ConfigurableReport.setDestination(File) 方法。: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最新:SDL2-android-studio:compileLint 最新:SDL2-android-studio: 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 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。SDLActivity:incrementalReleaseJavaCompilationSafeguard :SDLActivity:javaPreCompileRelease :SDLActivity:compileReleaseJavaWithJavac 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。SDLActivity:incrementalReleaseJavaCompilationSafeguard :SDLActivity:javaPreCompileRelease :SDLActivity:compileReleaseJavaWithJavac 注意:某些输入文件使用或覆盖已弃用的 API。注意:使用 -Xlint:deprecation 重新编译以获取详细信息。
: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] 链接 CXX 共享库 D:\corelab_proj\GearToTciPlayer2\dist ribution\main\lib\armeabi-v7a\libmain.so :SDLActivity :compileReleaseSources
在 1m 38s 内构建成功 133 个可操作的任务:77 个已执行,56 个最新