如何添加一个文件到Android的工作室路径1.3+与实验gradle这个插件(NDK)? [英] How to add a single file to paths in Android studio 1.3+ with experimental gradle plugin (NDK)?

查看:159
本文介绍了如何添加一个文件到Android的工作室路径1.3+与实验gradle这个插件(NDK)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多的例子与添加整个源文件夹像一个路径

There are a lot of examples with adding a whole source folder to paths like a

cppFlags += "-I${file("src/main/jni/native_app_glue")}".toString()

在新的实验gradle这个插件1.3 +

in new experimental gradle plugin for AS 1.3+

有没有一种方法,以单个源文件添加到它?

Is there a way to add single source file to it?

推荐答案

你展示片断添加包括目录,而不是源。它会添加页眉,而不是.C / .cpp文件。

The snippet you're showing is adding an include directory, not sources. It will add headers, not .c/.cpp files.

我还没有找到一种方法来添加一个单一来源。

I haven't found a way to add a single source.

该插件会寻找JNI文件夹内的所有资源。
您可以通过添加一个文件夹JNI的 jni.source.srcDirs 的:

The plugin will look for all the sources inside jni folders. You can add a jni folder using jni.source.srcDirs:

android.sources{
    main.jni {
        source {
            srcDirs += "src/main/other_jni_sources"
        }
    }
}

这篇关于如何添加一个文件到Android的工作室路径1.3+与实验gradle这个插件(NDK)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆