使用gradle&生成apk的NodeJS

时间:2017-07-09 16:10:47

标签: javascript android node.js gradle android-gradle

我正在尝试使用Nodejs以及带有NodeJs sync process的Gradle和以下代码生成apk文件:

const exec = require('child_process').execSync;
exec(`cd ~/appFolder && ./gradlew assembleRelease`);

现在请注意,当我执行时:

cd ~/appFolder && ./gradlew assembleRelease
从命令行

,它完美运行,我的构建成功。但是当我运行上面的javascript时,我收到以下错误:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in 
the local.properties file or with an ANDROID_HOME environment variable.

请注意,我确实设置了ANDROID_HOME,并在app文件夹中存在local.properties文件。 非常感谢你。

0 个答案:

没有答案