Push file from local system to android device in automation script using UIAutomator - adb

I need to push a file to android device from my local system through automation script using UIAutomator.
I have tried, using below code:
Runtime rt = Runtime.getRuntime();
Process pr=rt.exec("cmd /C start C:\\xxxx\\xxxx\\CopyfilesToDevice.bat");
pr.waitFor();
int exitValue=pr.exitValue();
Batch file "CopyfilesToDevice.bat" contains adb push command as mentioned below
adb push D:\xys\myfile.dat /data/local/tmp
The above code is executing successfully but the file is not copying to the device storage (data/local/tmp/).
Can anyone help me on this?
Thanks in Advance!!!
Mra

Related

how to disable launch of default emulator on 'react-native run-android'?

I don't want to run emulator at all. But 'react-native run-android' starts an emulator even though I have a physical device already connected ('adb devices' command shows it) and then 'react-native run-android' command fails with error 'error: more than one device/emulator'
info JS server already running.
'C:\Users\Wings' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
I had to delete all emulators in ADB to disable automatic launch of emulators but I think that shouldn't be the perfect solution as I will have to recreate AVDs when I need to.

Dump file is getting created and filling the space in drive

While running a standalone java application using .bat file , sometimes if the input file has large number of records , dump files getting created and thus filling up the space in the drive.
I am trying to increase heap memory in eclipse ,but while converting the application into a runnable jar file ,it is not taking the vm argument such as -Xmax 2048,-Xmas1024 etc. so the heap memory is not able to increase while running the jar file from a .bat file
java -Xmx2048m -Xms2048m
-version
set "curpath=%cd%"
start jdk file path\jdk\jdk\bin\javaw.exe -jar "Jarfile path /filename.jar"
java -version
pause
Above is the line i wrote in the .bat file to run the jar file
According to me it should increase the heap memory and the the application should not hang and dump file should not be created .But I am still getting those dump file and these are filling up my drive space.
If anyone knows how to resolve this please help me.

Daydream View Controller Emulator won't work with Google VR SDK 1.1 and Unity 5.6 beta for Linux

I can't get the controller emulator to work with Google VR SDK 1.1 & Unity 5.6b3 under Arch Linux 64-bit. If I load the GVRDemo scene in Unit and click the play button to enter Play Mode, the console shows the following:
"Android Debug Bridge (adb) command not found.
Verify that the Android SDK is installed and that the directory containing adb is included in your PATH environment variable."
In Windows, you have to add the directory containing the Android Debug Bridge (adb) program to the PATH environment variable in Windows itself (not in the Unity program). Once you do that, the Controller Emulator works fine in Windows. You have to do the same in Linux, evidently, to get Unity to locate adb, and therefore get the Controller Emulator phone working for testing the game.
I've added the following line in my .bashrc and .profile files in my home directory:
"PATH=/home/jesse/Android/Sdk/platform-tools/:$PATH"
This, however, doesn't fix the issue.
I've also added the root directory of the Android SDK to my Unity Preferences > External Tools section.
I don't know how to get Unity and Google VR SDK to recognize the directory containing adb to the PATH environment variable that Unity needs to make the Controller Emulator work.
Is anyone else having this issue? Is there a fix or work-around?
I was able to locate the culprit and modify Google VR SDK scripts to make it work! Turns out there was an issue in the code of the script file titled "EmulatorClientSocket.cs" regarding non-Windows machines. Here's what I changed, and why:
Originally, in line 111 and 112 of this script, it read:
stringprocessFilename="bash";
stringprocessArguments = string.Format(" -l -c \"{0}\"", adbCommand);
The context is that when Windows is not present (forgive my layman's terms -- I've only started learning coding a month ago) the command to process is this: bash -l -c "adb forward tcp:7003 tcp:7003". The problem is when the -l option is used in the command, the command is interpreted as if coming from a login shell, which - I believe - means that bash isn't looking at the custom environment variables set in the user's .bashrc and .profile files in their home directory. Without looking at those files, bash can't locate the adb command (try running the bold command above in a terminal, and the result will be a prompt saying adb command not found).
To fix it, I simply removed the -l option from line 112, and, voila! Everything works like a charm! Lines 111 and 112 now look like this:
stringprocessFilename="bash";
stringprocessArguments = string.Format(" -c \"{0}\"", adbCommand);
The fix will work when running "unity-editor" or "unity-editor-beta" from the Terminal or Xterm, but running it from the application menu will still produce the adb error and Controller Emulator will not work.

Start/Stop adb daemon programmatically in android

I want to make an app.which can start and stop adb daemon which i want to run on Google Nexus 7(Android 5.0.1).
I downloaded the nexus 7 source code and created an app. in packages/app folder and built it in system/priv-app.
I am using following code for starting and stoping adb daemon :
Runtime.getRuntime().exec("setprop service.adb.tcp.port 5555");
Runtime.getRuntime().exec("stop adbd");
Runtime.getRuntime().exec("start adbd");
But its not working.
It works fine on an emulator(Android 4.4), but not on the device.
Can any one please suggest if anything more needs to be done for the above code to work on device.
I am having the
whole system code.
Thanks

how to set Environment variables for google cloud sdk ubuntu 12.04

I had installed google cloud sdk on ubuntu but opted no for updating path variables .and received the following message
please help
how to add path of this inc file permanently tc
Source [/home/usr/google-cloud-sdk/path.bash.inc]
in your profile to add the Google Cloud SDK command line tools to your $PATH
If you are using bash, you can source the file into your profile by adding the following line to your ~/.bashrc file:
source /home/usr/google-cloud-sdk/path.bash.inc

Resources