I have this application which I'm testing. I use a script which automatically installs the app but I also want to restart the device. This is important as after the installation I run a monkey-test on the device and all kind of quirks and bugs may arise. To get rid of these I want to restart the phone to get it into some kind of "known state". (These bugs are not only in the app as the phone has been known to suddenly shutdown during the tests)
My installation script is run with jython and I know of the device.reboot() command but this takes almost no time at all (which makes me suspicious) and doesn't work very well. I know there's three arguments: "bootloader", "recovery" and "None" but I can't find the impact these would have on the device.
So my question is, is device.reboot() the right command to use? If yes, what happens when I don't use any arguments with the device.reboot() command and what is the effects of the arguments.
It may be worth mentioning that I run the jython script from a batch command prompt in jenkins. So any batch commands using adb or similar would work just as fine.
device.reboot("None") works on my device
Related
I know this question has been asked a thousand times but I find myself in a situation I cannot quite explain.
I get No target specified, deploying to device '0123456789ABCDEF' even though I specified the target with the switch --target with the below command.
ionic cordova run android --target:0123456789ABCDEF
But I get the following:
No target specified, deploying to device '0123456789ABCDEF'
I even tried to add the --device:0123456789ABCDEF switch as well but all the same.
How can I actually make it deploy correctly?
In addition, if I have 2 android devices deployed, it mostly deploys to the other device instead. To work around this, I usually unplug the second device, then plug it again when deployment is done.
According to the CLI docs example you need to use = to give the value and not :.
Use:
ionic cordova run android --target=0123456789ABCDEF
I have created a VM Ubuntu 14.04 using Vmware Player, and I've installed the ADT environment for Android Development.
I have created a new Android emulator using the shortcuts present in Eclipse; when I tried to start emulator I got the following known error:
Starting emulator for AVD 'AVD_for_Nexus_5_by_Google'
ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them
you will have to do at least one of the following:
- Use the '-force-32bit' option when invoking 'emulator'.
- Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.
Either one will allow you to use the 32-bit binaries, but please be
aware that these will disappear in a future Android SDK release.
Consider moving to a 64-bit Linux system before that happens.
I fixed it in both ways: putting a variable in my .bashrc:
export ANDROID_EMULATOR_FORCE_32BIT=true
and also setting the emulator option in the Eclipse preference dialog:
Nevertheless, every time I try to start the emulator I got always the same error.
The wierd thing is that if I try to start the emulator from a bash window, it starts normally.
This could have been a boring workaround, but I would have been happy anyway. The problem is that when I try to deploy an application from Eclipse, the emulator started in this way is shown as "Offline" and I cannot run any application on it. Possibly I can upload the apk into the emulator from the command line, but debugging the app would become a bit harder.
Has anyone got the same problem or does know how to fix it?
I found out a partial solution for connecting eclipse to the running emulator started by command line: the emulator MUST be started with no snapshots.
Indeed, if I start the emulator without snaspshots, it become "online" in DDMS, and I can finally use it.
Although this could be a bit annoying, because starting the emulator from scratch every time it takes a long time, at least I have a way to use it.
On the other hand, I don't know exactly the reason of this behavior, if someone has an answer it will be appreciated.
Moreover, I still do not have idea why I'm not able to start the emulator from Eclipse.
There was time, when SL4A worked fine on my ICS phone (rooted, ofk). Than a factory reset happend; after it everything works just fine, except problem with SL4A.
I install SL4A; it can run shell scripts.
Than I install Python for Android or Perl for Android. I can run Python or Perl scripts. Nice.
Then I reboot. After reboot any attempt to do anything with SL4A (run script or start private server(any port)) results in
Unfortunately, SL4A has stopped.
Then it crashes second time, even if I have not launched it again manually.
Forever. (Till another clean install).
It occurs with all versions of SL4A and Python apk.
Here is full log(careful: 5k+ lines of text), and here is piece of log, filtered to warnings.
You can see, that first error, that looks relevant, in all cases is
E/sl4a.SimpleServer:156(2564): Failed to start server.
I have no idea what happens.
This is not quite programming question, so would have asked it at android.stackexchange, but it looks that they don't even have special tag for sl4a, so I posted it here.
Thanks in advance.
Go to apps in settings and Force Stop + clear the data. This usually fixes it for me. Seems to be a bug somewhere.
I did have problems with my andriod version.
Installing both SL4A and python from here fixed this.
More details on the original post, over here:
https://groups.google.com/forum/#!topic/android-scripting/tOovx2HprQk
I have been developing on Android with Eclipse for a while, and I recently switched over to using Ant for my build system. This gives me a number of useful advantages, but it seems to really badly break Eclipse's behavior with respect to building and the emulator.
My biggest problem right now is that, if I change something in my code and hit the "Run" or "Debug" buttons, it rebuilds the app like it's supposed to, but when it comes time to install the app and run it, I get the dreaded "Application already deployed. No need to reinstall." message, and it refuses to install it. Even if I do a "clean" and rebuild my app from scratch, it still doesn't recognize it as newer than the one installed on the emulator.
Of course, I can uninstall the app from my emulator first, but that's a huge PITA, because my app involves setting up a user account after initial install, and I don't want to have to do that every time I am testing a change. I can also force install from the command line through "adb -e install -r ...". That's what I'm doing now, but it's an extra step that shouldn't be necessary. I would really like to be able to take advantage of the "I" part of my IDE and actually compile, run, and install from it the way I am supposed to be able to.
How does the Android SDK in Eclipse decide whether the app needs to be reinstalled? Is there a timestamp on some particular file that it looks at? Is there a way I can force it to install every time?
There has to be a solution to this problem.
This works fine in my eclipse, and it always had. So I would suggest:
reinstall ADT plugin
reinstall eclipse altogether.
Or you can workaround this issue by adding extra step to your project with "adb -e install -r ..." command line (using ant build script).
When developing on BlackBerry or iOS, you can deploy your application just by dropping the compiled code into a special directory, and when the simulator boots up it will check that directory and install any apps that it finds there. Is this possible for Android?
The reason this feature is desirable is because my build system deploys builds nightly. I want the emulator ready to go when my QA team gets in the next morning. To do that, I have to write a script that boots up the emulator, waits for it to start up, then calls adb install and finally shuts down the emulator. It would be great if I could just drop the .apk in a directory and have it ready to go the next time QA boots up the emulator.
Edit:
Someone asked for the script I described above. It's unfortunately written in Perl, but here it is: http://pastebin.com/6UcNgYRs
Edit 2:
I just found an awesome little command that can help you if you're trying to write a script like the one I mentioned above. You can have your script wait for the emulator to come online with the command $ adb wait-for-device!!
Is this possible for Android?
No, sorry. Nice idea, though.
You can just tell the QA people to use the install script as the emulator itself, just remove the "close the emulator" bit.