Search code examples
androidbatch-fileadb

how to install apk from pc using relative path


I'm trying to install apk file from my PC on my android device and I have a problem. when I erite these code it's all ok

adb install "C:\Users\ntuser\Documents\workspace\Team\apps\_sample\samples\sample_app\build\outputs\apk\app-debug.apk"

but when I'm trying to give relative path it doesn't work

adb install "%~f0\..\..\apps\app_sample\samples\sample_app\build\outputs\apk\app-debug.apk"

I also tried to go into the folder and then install but it alsi did not work

cd %~f0\..\..\apps\app_sample\samples\sample_app\build\outputs\apk\
adb install "app-debug.apk"

Can someone help me please?


Solution

  • Now I got a better answer when I asked about something else...

    The best command to install app using relative path is adb.exe install and not adb install.

    adb.exe install "%~f0\..\..\apps\app_sample\samples\sample_app\build\outputs\apk\sample_app-debug.apk
    

    That's the nicest way doing it!

    And thanks to Mofi that gave me this idea in his answer here