Gulp Build Android project, install APK
Previous section Gulp installation and use this article says that Gulp can execute terminal commands, isn't there a lot of ideas,:)
This article is not much technical, only for entertainment
Test environment
- mac:10.10.4
- gulp:3.9.0
- Android studio:1.3
- time:2015 August 21 17:29:07
Premise
The entire Android project has been compiled in Android studio and is ready to work. If it is not compiled, it can only output the error log at the terminal.
File directory
|----gulpfils.js|----AndroidProject |----app | |----build | | |----xxxx | | | |----xxxx | |----xxxx |----xxxx
Build project, install APK
Everyone knows to build the project with gradle build , install apk with adb install xxx.apk .
Nonsense not much to say on the code
varGulp =require(' Gulp '), exec =require(' child_process '). Exec;gulp.task (' Default ', function(){exec' CD androidproject && gradle build ', function(){ if(Error!==NULL) {Console.log ("Gradle Build Error:"+ error); }Else{Console.log ("Gradle build OK"); exec' adb install-r androidproject/app/build/outputs/apk/app-debug.apk '); } });});
This tool is not very convenient, save the dot on the compiler to compile, run the app.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Gulp Build Android project, install APK