Let's take a close look onto the command you have executed:
adb shell "run-as com.example.myapplication push C:\\Users\\x00879271\\Desktop\\ttest /data/data/com.example.myapplication"
The main problem is the adb shell
part at the beginning. With this command you open up a shell on the Android device. Everything after adb shell
is executed on your Android device. Therefore specifying a path like C:\\Users\\x00879271\\Desktop\\ttest
which refers to a file on your PC won't work because it is executed on Android which doesn't have access to files on your PC.
If you want to push a file and use run-as you can not do this in one command. Split it into multiple commands:
Push the file to a common directory: adb push C:\\Users\\x00879271\\Desktop\\ttest /sdcard/
Copy the file to into the app directory
adb shell run-as com.example.app sh -c 'cp /sdcard/ttest /data/data/com.example.myapplication/'
The above command requires the cp
command to be present on your device. On older devices it is missing which requires you to use a workaround using cat
: 'cat /sdcard/ttest > /data/data/com.example.myapplication/ttest'
for the last part of the command.
If you are interested what commands Android Studio performs when uploading an file e.g. in Device Explorer please see my answer here.