Installing .apk file on Emulator in Linux - android

I'm trying to integrate the Zxing Bar code scanner into an application, but I need to install the bar code application on the emulator first. I already downloaded the .apk file. How do I install it on the emulator? I'm running Ububtu.

Goto Shell/Terminal/, reach at android-sdk/tools directory then
adb install fileName.apk
or ./adb install fileName.apk

Start emulator.
android-sdk-linux/platform-tools > ./adb -e install Test-debug.apk

Related

Error installing (arcore-preview.apk) via USB/debugging mode on an Android Smartphone

I was following the instructions given on this https://developers.google.com/ar/develop/java/getting-started Google Developers Website but when I tried to install the APK file on my Android Device via Terminal (macOS)
Terminal gave me this error:
$ adb devices -l List of devices attached 93eafadd device usb:336592896X product:kenzo model:Redmi_Note_3 device:kenzo
$ adb install -r -d arcore-preview.apk Invalid APK file: arcore-preview.apk Sayans-iMac:~ sayan$
So I even transferred the APK to my Android device and tried to install it in the Android device it self manually, but I got this error: error parsing package!
I don't know why this is happening and I have also enabled USB debugging!
I had this same problem, but had not pointed adb to the right package:
adb install -r -d ~/Downloads/arcore-preview.apk
"Your download directory might vary."

How to install .apk file using adb on nixos?

I'm running nixos and I have a .apk file, i.e. an Android app.
There is the handy tool adb (Android Debug Bridge) and the command
adb install /path/to/app.apk
How do I get it to work on nixos?
The binary adb is in androidsdk. So either run
nix-env -i androidsdk
or add androidsdk to the list environment.systemPackages in /etc/nixos/configuration.nix.
Your Android phone needs to be plugged in and have USB debugging enabled as documented on developer.android.com.
Simply running adb install ... didn't work for me. Instead I did
sudo adb start-server
adb install /path/to/app.apk
or
adb install /path/to/app.apk -r
for overwriting an already installed app.

Batch file to run an Android app in emulator

compile.bat:
set PATH=%PATH%;H:\Source\Program\sdk\tools;
set PATH=%PATH%;H:\Source\Program\sdk\platform-tools;
cd sdk\tools
emulator -avd emulator2
adb wait-for-device
cd sdk\platform-tools
adb install -r SP.apk
Here is my batch file to run a .apk into an emulator. It is from a CD, my adviser wants to run my app in his computer using my CD. My SDK folder is also in the CD and is the same directory with my compile.bat. Is my setting of path correct? Also there is an error when I test the compile.bat from the cd, it says too many files specified; only take APK file and verifier file.
The adb install command also become like this adb install -r SP.apk apk P.apk T_ROOTPROJECT_NAME-debug.apk. I only want to install SP.apk in the emulator.
When I run the commands in cmd, not in a batch file it is working.
Also I want to know how to enable the camera in my laptop to the emulator. My app requires the camera to run.
Can someone help me please? I am begging you. I need this tomorrow its for my graduation. Thank you.

Can't install apk via adb, file DNE despite showing up using adb shell ls

I uploaded an apk using adb
adb push myAppName.apk /sdcard/
to double check:
adb shell ls /sdcard/
sure enough, it's there.
then:
adb install /sdcard/myAppName.apk
can't find '/sdcard/myAppName.apk' to install
Note* I tried adding the path in parentheses as suggested on an xda post but this didn't help.
Are there multiple sdcard directories where push defaults to one and install defaults to another? I tried using root explorer to find the files that adb install /sdcard/<TAB> suggests but I can't file these files in any dir.
adb install takes a file on your pc to install it. It doesn't look on the phone.
You can use:
adb shell pm install /mnt/sdcard/myAppName.apk
It will install apk from the device it self.
Please check Package Manager here.
Connect your device and the from the location where you have your app.apk do adb install app.apk . It will install it to your device.

Where is the deployed apk file? how to uninstall it with adb?

I have tried to install my apk using adb like this:
D:\C_Desktop\Development\Android SDK\platform-tools>adb install "C:\test_haxe\bin\android\bin\bin\testhaxe-debug.apk"
4274 KB/s (3702929 bytes in 0.846s)
pkg: /data/local/tmp/testhaxe-debug.apk
Success
so, its installed fine, but at my phone, I couldn't find the apk file, is it deleted after being installed?!
also, I tried to uninstall it like this:
adb uninstall com.ketab.haxe
but I get
Failure
Because I have no emulator, I will have to install the app each time to see the progress, so I will need to uninstall it and then install the new app on my phone, is this the right way to go any way?
to find out the apk file location after installation use pm path <package> command:
adb shell pm path com.ketab.haxe
you could try uninstalling the package with:
adb shell pm uninstall com.ketab.haxe
in case of failure check the error message with:
adb logcat -d -s PackageManager:*
Linux/mac users can also create a script to uninstall ("delete") an apk with something like the following. Create a file named adb-uninstall with these 3 lines:
pkg=$(aapt dump badging $1|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
adb uninstall $pkg
Then chmod +x adb-uninstall to make it executable.
now you can simply:
adb-uninstall myapp.apk
The benefit here is that you don't need to know the package name. Similarly, you can create adb-run myapp.apk.
Note: This requires that you have aapt in your path. You can find it under the new build tools folder in the SDK.
[with solution] I couln't find the apk file on my android device after installing successfuly from the command line my app apk (adb install ~/Downloads/myapp.apk) . After searching my phone's File Manager, I found out the app was downloaded as an APP and not as an apk file, as I had expected.
So if anyone else was looking for the apk file - it's an application and not a file you can see

Categories

Resources