Search code examples
androidbatch-fileadb

How to install android apk using batchfile


I am working on hybrid application for that every time i have to move some files from some place to assets in android application,so for this i wrote batch file.If i execute line by line command in command prompt it is working but if run batch file it is stopping before installing apk in device.

commands:

D:
cd D:\NewFolder\SampleApp
gradlew.bat assembleDebug
cd D:\NewFolder\SampleApp\app\build\outputs\apk
adb -d install  app-debug.apk

Solution

  • If we are running in multiple batch files in batch file,we should use call for gradlew.bat assembleDebug, Actually it is closing command prompt so that remaining commands are not executing.

    commands:
    
    D:
    cd D:\NewFolder\SampleApp
    call gradlew.bat assembleDebug
    cd D:\NewFolder\SampleApp\app\build\outputs\apk
    adb -d install  app-debug.apk