我升级到Android Studio 3.0。构建在我的OS X dev机器上(在IDE和命令行中)都能正常工作,但在我们的Linux构建器(命令行)上失败。
我们的项目有一个app
模块,它依赖于common
(Java)模块和lib
(C ++)模块。 lib
模块使用CMake构建,并使用SWIG为C ++代码生成Java API。
在构建器上,:app:javaPreCompileRelease
任务在:lib:generateJsonModelRelease
之前执行,它启动CMake构建。这导致app
模块中的编译错误,因为尚未在lib
CMake构建中生成Java类。
有没有办法强制执行此依赖项?我不确定为什么平台/版本之间的行为不同。
工作构建输出
:clean UP-TO-DATE
:app:clean UP-TO-DATE
:lib:externalNativeBuildCleanDebug
:lib:externalNativeBuildCleanRelease
:lib:clean UP-TO-DATE
:common:clean UP-TO-DATE
:app:preBuild UP-TO-DATE
:lib:preBuild UP-TO-DATE
:lib:preReleaseBuild UP-TO-DATE
:lib:checkReleaseManifest
:lib:processReleaseManifest
:common:preBuild UP-TO-DATE
:common:preReleaseBuild UP-TO-DATE
:common:checkReleaseManifest
:common:processReleaseManifest
:app:preReleaseBuild
:lib:compileReleaseAidl
:common:compileReleaseAidl
:app:compileReleaseAidl
:lib:packageReleaseRenderscript NO-SOURCE
:common:packageReleaseRenderscript NO-SOURCE
:app:compileReleaseRenderscript
:app:checkReleaseManifest
:app:generateReleaseBuildConfig
:app:prepareLintJar
:app:generateReleaseResValues
:app:generateReleaseResources
:lib:compileReleaseRenderscript
:lib:generateReleaseResValues
:lib:generateReleaseResources
:lib:packageReleaseResources
:common:compileReleaseRenderscript
:common:generateReleaseResValues
:common:generateReleaseResources
:common:packageReleaseResources
:app:mergeReleaseResources
:app:createReleaseCompatibleScreenManifests
:app:processReleaseManifest
:app:splitsDiscoveryTaskRelease
:lib:platformAttrExtractor
:common:platformAttrExtractor
:lib:generateReleaseBuildConfig
:lib:prepareLintJar
:lib:javaPreCompileRelease
:lib:processReleaseJavaRes NO-SOURCE
:common:generateReleaseBuildConfig
:common:prepareLintJar
:common:javaPreCompileRelease
:common:processReleaseJavaRes NO-SOURCE
:app:compileReleaseNdk NO-SOURCE
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:lib:mergeReleaseShaders
:lib:compileReleaseShaders
:lib:generateReleaseAssets
:lib:mergeReleaseAssets
:common:mergeReleaseShaders
:common:compileReleaseShaders
:common:generateReleaseAssets
:common:mergeReleaseAssets
:app:mergeReleaseAssets
:app:mergeReleaseJniLibFolders
:lib:generateJsonModelRelease
...... CMake构建开始;构建成功完成
构建输出失败
:clean UP-TO-DATE
:app:clean UP-TO-DATE
:lib:externalNativeBuildCleanDebug
:lib:externalNativeBuildCleanRelease
:lib:clean UP-TO-DATE
:common:clean UP-TO-DATE
:app:preBuild UP-TO-DATE
:lib:preBuild UP-TO-DATE
:lib:preReleaseBuild UP-TO-DATE
:lib:checkReleaseManifest
:lib:processReleaseManifest
:common:preBuild UP-TO-DATE
:common:preReleaseBuild UP-TO-DATE
:common:checkReleaseManifest
:common:processReleaseManifest
:app:preReleaseBuild
:lib:compileReleaseAidl
:common:compileReleaseAidl
:app:compileReleaseAidl
:lib:packageReleaseRenderscript NO-SOURCE
:common:packageReleaseRenderscript NO-SOURCE
:app:compileReleaseRenderscript
:app:checkReleaseManifest
:app:generateReleaseBuildConfig
:app:prepareLintJar
:app:generateReleaseResValues
:app:generateReleaseResources
:lib:compileReleaseRenderscript
:lib:generateReleaseResValues
:lib:generateReleaseResources
:lib:packageReleaseResources
:common:compileReleaseRenderscript
:common:generateReleaseResValues
:common:generateReleaseResources
:common:packageReleaseResources
:app:mergeReleaseResources
:app:createReleaseCompatibleScreenManifests
:app:processReleaseManifest
:app:splitsDiscoveryTaskRelease
:lib:platformAttrExtractor
:common:platformAttrExtractor
:common:processReleaseResources
:lib:processReleaseResources
:app:processReleaseResources
:app:generateReleaseSources
:lib:generateReleaseBuildConfig
:lib:prepareLintJar
:lib:generateReleaseSources
:lib:javaPreCompileRelease
:lib:compileReleaseJavaWithJavac
:lib:processReleaseJavaRes NO-SOURCE
:lib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:common:generateReleaseBuildConfig
:common:prepareLintJar
:common:generateReleaseSources
:common:javaPreCompileRelease
:common:compileReleaseJavaWithJavac
:common:processReleaseJavaRes NO-SOURCE
:common:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
:app:javaPreCompileRelease
...编译应该在CMake构建中生成的缺少Java类的错误
答案 0 :(得分:0)
虽然我没有找到让构建正常运行的方法,但我能够分两步运行它:
./gradlew lib:assembleRelease
./gradlew assembleRelease