using adb to remove an application in bash script - bash

I have put together a bash script that automates the installation and removal of various apks.
The script uses adb to install to sdcard then uninstall packagename to remove. If it has problems finding the package name (it's only happened if the AndroidManifest is broke) it reverts to using adb to get to the applications menu via shell input keyevent "direction" to the sdcard section then as there will only be one app here it selects it and removes it.
The problem is that the script now has to run on a nexus 5 running kitkat.. so the only way to view the app list is by way of 'downloaded apps', 'running apps' and 'all apps'. The install will now be to the handset not sdcard as nexus has no sdcard.
Can anyone recommend a way to find the last installed app to android 4.4 so I can use its name within a variable to remove it? I've been told to try pm list packages, but this is no good as I won't know what the app is called when away from the phone.
The handset is rooted if that helps..
thanks

Related

iFuse to access iPhone files on Windows

Trying to use iFuse to access iPhone files on Windows but not getting anyway. Would appreciate if people can share instructions/steps on how to get this to work?
iFuse to access iPhone files on Ubuntu works well; therefore, I am confident the issue is on Windows.
Using https://github.com/hooby3dfx/ifuse/releases/tag/win-dokany-0.1
Unzip test.zip in the above link
make sure iTune is installed
Install the specified Dokan version; doesn't seem to work with the latest Dokan version
Open a command window in Admin mode to run the command (e.g. ifuse tmnt --container bundle ID)
While the command is still running in the Admin window, open another command window to list the mounted directory

Mono.framework is missing on my mac ... but it's... there?

Please help me interwebs.
I'm having trouble getting my xamarin app to work. I've done a reinstall of Mac OS X and installed Xamarin using the installer, which adds mono and all the rest of it.
Now when I open up terminal and type which mono i get
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
...which is what I expect.
But when I navigate to that place (again in terminal) there's nothing there.
From my root folder I go "cd System/Library/Frameworks " and then hit ls and I get a looooong list of installed frameworks but no Mono.framework.
If I go to Apple > About this Mac > System Report > Frameworks Mono IS listed. I can execute Mono commands on the command line. If I look in paths.d the specified path for mono is /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono but I can't find that location so how is it even a thing?
My linux skills are not great, can anyone please help me understand what's going on here?
I think you are looking in the 'wrong' Library folder. There are a few different Library folders. There is one under the Disk Drive (root) directory, one under the User directory, one under the System directory. I think they are all hidden by default. So you need to set your folder/view options explicitly to show the Library folder since it might be hidden by default. The directory you are looking for is directly under you Disk Drive (root).

Install iOS simulators from the command line

I have a CI setup with multiple slaves. I'd like to install different versions of the iOS simulator, but this needs to be done from the Downloads tab in the Xcode Preferences. Ideally there would be a command line tool that we could run to download and install specific versions. Does this exist?
If you don't care about having the system keep track of the package receipts, you can just install them on one of your systems and then rsync /Library/Developer/CoreSimulator/Profiles/Runtimes over to the other systems.
Note that after the transfer, I'd suggest doing 'sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService' on the other slaves since the service expects the profiles to be moved into place and might not respond well to the rsync.

Using Automator to copy files, execute Cordova not working

I'm trying to create an Automator workflow which:
gets files and folders of a directory
copies those files and folders to another directory (with overwrite)
run a shell command: cordova prepare
The issue i have is, I'm working in one folder and wanting to be able to run an application that does the above, rather than manually do it every time i need to refresh the Cordova app.
The first two of the above works fine, i see the files copy/overwrite as they should, but when it gets to the shell command it returns the error code "cordova - command not found (127)"
Is it because I have Cordova installed for my user only and it wont execute as root (or whatever OS X the Automator user is)? If so how would i get it to run as another user or install it globally?
I've tested a simple command such as "cd ~/Sites/ && open ./" which works fine without error. It's just the cordova not found thing which i have going on at the moment.
Thanks in advance.
When you call the cordova command, are you using the entire path to the Cordova app? Something like this:
/Applications/Cordova.app

Permanent removal of all IMEs?

I use Ubuntu 12.04, 64-bit, Acer Aspire One D270
I gave these commands
adb shell mount -rw -o remount /dev/block/mtdblock0 /system
adb shell rm /system/app/PinyinIME.apk
adb shell rm /system/app/LatinIME.apk
adb shell rm /system/app/OpenWnn.apk
and thought they were lethal weapons in getting rid of the thorny IMEs installed in the emulator, thereby enabling me to work solely with the hardware keyboard and saving me the trouble of going to Language and Keyboard settings each time I start the emulator and disabling the IMEs.
But I had never imagined that there would be even the remotest chance that all the IMEs (but for the sample soft keyboard which I removed using adb uninstall) would be back and enabled once I restarted the emulator for next use!
How to make the adb shell rm command permanent? It seems from this that the removals using uninstall are permanent. So I tried using the adb uninstall command to uninstall the other IMEs:
aneesh#nb-14:~$ adb uninstall jp.co.omronsoft.openwnn
Failure
aneesh#nb-14:~$ adb uninstall com.android.inputmethod.pinyin.PinyinIME
Failure
aneesh#nb-14:~$ adb uninstall com.android.inputmethod.latin.LatinIME
Failure
Why does this not work?? If none of the above is answerable then consider the following: In light of the fact that all the IMEs are reinstalled, it's obvious that theire installation is part of the booting process of the emulator. Can someone help me to remove these IME installation commands from the boot process??
I want this pain-in-the-ass killed because, if after inserting an emoticon (whatsapp) I change the position of the cursor to insert some text, I find that the cursor remains there for 3 to 8 seconds and goes back to its original position and the honourable dignitary, Latin keyboard comes up. Then it lets me insert text wherever I want until I again want to insert smileys. But this initial fuss each time I change cursor position does not augur well with me!
Snapshot enabling option is missing! Screenshot below:
As a result it's not surprising that even the Launch from Snapshot and Save from Snapshot options are disabled:
When I create an emulator from the latest version it still shows the same options as in the first screenshot in this question, no emulation options. Really strange! Been updating to newer sdk versions but never saw this development!
You cannot use adb uninstall on apps installed in the /system directory.
If those apps are "reappearing" after you restart the emulator, I would imagine it is because your emulator is not using snapshots, to save the current state when it closes.
If you are using Eclipse/AVD manager to manage your emulators, take a look at the pictures below. If you are using snapshots, and the apps are still restored, please comment or update your question. Then we can look for an alternate solution.
Enable snapsots when creating emulator:
Launch emulator from snapshot:
Images courtesy of: http://tools.android.com/recent/emulatorsnapshots
Edit:
In Ubuntu, you should still have the option to enable snapshots. I tested creating an emulator without initially enabling snapshots, and when I edit-ed the AVD, I had the snapshot option:
I am a little confused, since you have the snapshot option (albeit, not available) in the AVD launch options. Are you using the latest version of the SDK?
Edit 2:
When creating a new AVD, do you have the emulator options?
Edit 3:
Alright, I'm really starting to run out of ideas here. I take it that when you create an AVD you do not have the snapshot options? I updated to the latest version of the SDK manager and I did have them.
Try making an emulator through the command line:
Use:
android list targets
to get a list of target IDs.
Then create the AVD:
android create avd -t 12 -n test_002 -a --abi armeabi_v7a
The -a argument will specify that the emulator should use snapshots. In my case, 12 was the ID of 4.2.2, but it may vary so use the first command to find the ID you want. For more information on command line options see the following:
http://developer.android.com/tools/help/android.html
http://developer.android.com/tools/help/emulator.html
You should be able to add combinations of -help to most of the commands to get additional help info.

Resources