简体   繁体   English

来自 Android Studio 的详细构建日志

[英]Verbose build logs from Android Studio

How do I get a verbose log (including the command-line arguments to compiler and linker) when building with Android Studio?使用 Android Studio 构建时如何获取详细日志(包括编译器和链接器的命令行参数)?

I have just transitioned from Ant / Android.mk builds to Android-Studio builds.我刚刚从 Ant / Android.mk 构建过渡到 Android-Studio 构建。 With the old system, I was able to see how the compiler was evoked by doing:使用旧系统,我能够通过执行以下操作来了解编译器是如何调用的:

$ ndk-build V=1

What would be the equivalent setting in Android Studio to accomplish this? Android Studio 中实现此目的的等效设置是什么? I have a suspicion that my project is building against the wrong GLES version (gles2 instead of gles3) and want to make sure by seeing the command line arguments to the linker.我怀疑我的项目是针对错误的 GLES 版本(gles2 而不是 gles3)构建的,并希望通过查看链接器的命令行参数来确定。

It turns out you can make the build verbose by changing the build.gradle file as follows:事实证明,您可以通过如下更改 build.gradle 文件来使构建变得冗长:

    externalNativeBuild {
        cmake {
            arguments "-DCMAKE_VERBOSE_MAKEFILE=1"       
        }
    }

When using ndk-build instead of cmake, use this instead:当使用 ndk-build 而不是 cmake 时,请改用它:

    externalNativeBuild {
        ndkBuild {
            arguments "V=1"
        }
    }

Regarding to https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/NdkBuild there is no possibility to pass arguments.关于https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/NdkBuild不可能传递参数。
But you can pass an the folder for outputs, which generates .json files但是你可以传递一个输出文件夹,它会生成 .json 文件

    externalNativeBuild {
        ndkBuild {
            // Tells Gradle to put outputs from external native
            // builds in the path specified below.
            buildStagingDirectory "./outputs/ndk-build"
            path 'Android.mk'
        }
    }

So in my case in outputs/ndk-build/debug/json_generation_record.json the last "message" told me the error:所以在我的情况下,输出/ndk-build/debug/json_generation_record.json 最后一个“消息”告诉我错误:

JSON generation completed with problem. Exception: Build command failed.
Error while executing process .... ndk-build.cmd ....
...
Android.mk:myLib-prebuilt: LOCAL_SRC_FILES points to a missing file 
Android NDK: Check that ... exists  or that its path is correct 
...prebuilt-library.mk:45: *** Android NDK: Aborting    .  Stop.\n"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM