I try to understand how this works:
When I create an android app and run it from Eclipse, Eclipse takes care of generating the apk file and uses adb to install it on the phone correct?
When I have an .apk file that I try to push on the phone and use ADB directly in a command line by calling adb install myApp.apk I can't because my phone isn't rooted?
How does Eclipse manages to install apps then?
Is there a way to install from an .apk file on a device without having it rooted ? Obviously Eclipse is able to.
Thanks for any information that may help clarifying this.
David
So the really short answer to your question; You don't need to be rooted to use ADB, all android phones can use ADB without being rooted.
Also, the only reason you would need root is to mess with things on the system level, when installing a regular app you are just installing it like a regular application (to the data partition). Eclipse installs the app using ADB actually, so pushing an app using ADB is the same as installing it through eclipse.
You don't need to be rooted to use ADB, all android phones can use ADB without being rooted. You must be rooted to push applications to /system/apps/ to make them system applications. Also if you download a file explorer like ES File Explorer to your phone, you can transfer an apk file to your phones storage and using a file explorer (I really do recommend ES File Explorer) you can install that app.
Also just a tip, to use ADB command line you must enable ADB on your phone in developer settings.
Go to the settings menu, and scroll down to "About phone." Tap it.
Scroll down to the bottom again, where you see "Build number."
Tap it seven (7) times. After the third tap, you'll see a dialog that says you're four taps away from being a developer. Keep on tapping and the developer settings will show up in the settings app. There you can turn on ADB.
Hope this helps.
Further Reading: http://developer.android.com/tools/help/adb.html
http://www.androidcentral.com/how-enable-developer-settings-android-42
Related
I read a lot about SELinux, and I would have liked to try and get my hands on a case study for the university.
I have installed various virtual devices on GenyMotion, from Android 6 to Android 9, but nobody owns SElinux: when I do "sestatus" it answers "disabled".
I do not think it's enough to enable it, it seems that the modules must be installed in the kernel, can someone tell me how to do it? I tried but I did not find anything, I'm having a lot of difficulties, it's the first time I do these things.
Thanks to everyone in advance.
Finally I managed to make everything work: I was able to access Selinux information via a terminal in the GenyMotion virtual device. Selinux is already active on devices after version 4.3, there is no need to install it as it said #Martin Zeitler. I explain the solution to the problem (on Linux it works).
The first thing to do is to install a terminal in the virtual device: I have installed Termux. To do this, just download the apk from a site and drag it to the virtual device, the installation will start. Subsequently, it is necessary to provide the SuperUser permissions to the Termux terminal: banally, by opening the terminal, provide the SU command, and the device will ask you if you want to provide SuperUser permissions to the Termux application. When you enter the SU command, it will allow you to browse the folders on your device. With the "ls" command, providing the "-Z" option, you can see the SElinux context of the files. From the terminal, using the "getenforce" command, you can see how Selinux is running. Here you will see other useful commands: https://www.all-things-android.com/content/se-android-commands
Now, you will need to download the tool that allows us to interact with Selinux: setools. https://github.com/pasis/setools-android These tools are written in C, the native language of Android, so you need to download the NDK library to compile them: https://developer.android.com/ndk/downloads/
The first thing to do to compile, is to specify the project path:
export NDK_PROJECT_PATH=/my/project/path . The second step is to specify the makefile:
ndk-build NDK_APPLICATION_MK=/my/project/Makefile.am (for a complete guide: https://software.intel.com/en-us/articles/building-an-android-command-line-application-using-the-ndk-build-tools)
When you have finished compiling, you can send the Setools folder to the virtual device, using the adb program. ./adb push /setool/local/folder /remote/device/folder
(example: ./adb /setool /tmp) Now that you have Setool on your device, you can run the tools in the "/setool/obj/local/x86" folder. Thanks to "sepolicy-inject" you can also add rules to the policies.
Finally, thanks to this guide I realized that Selinux policies are stored in binary format, so it is not possible to interact with them without tools.
https://ge0n0sis.github.io/posts/2015/12/exploring-androids-selinux-kernel-policy/
one cannot "install SE Linux" on Android; because it's already installed and enabled by default since API level 21. you'd need to become user root, in order to access these management commands. this would only be possible on a rooted hardware device - or a rooted emulator image.
... just install CentOS or whatever else security enabled Linux distribution, for a test.
I want to test my application on actual device, so how can I go for it? And is it accessory to sign in and use zipalign for this purpose, or they are useful when preparing for publish my application? And is there any way to test my application on actual device without using eclipse?
download and install Android SDK
Make usb debugging enabled in your device
Connect your device to computer
go to command prompt and write: "adb devices" this will list all the devices connected
adb install "path/App.apk"
and you are done. Please note that adb command will run correctly from anywhere if you are having a correct path pointing to android sdk / plateform-tools direcory
I hope this will help you
Yes u can directly install your application into actual device without signing and zipalign. You can install the drivers for your software into your computer and use you device directly for debugging alternative to Emulator
Refer Using Hardware Devices
or you can install using Android adb tool Refer Installing an Application
or you can directly copy your application package file to you sdcard and install
The easy steps to install your apk using File manager :
Copy the APK
file you want to install to your phone's memory card.
And disconnect Phone from USB.
Go to Android Market and search and download Astro File Manager.
Click on the Install button.
After it is installed, open the app (Astro).
It will show you your application APK file stored directly in the root directory of your memory card.
Just tap on the application you want to install
Tap on “Open App Manager”
Click Install
You are done!
P.S: Don't forget to enable Unknown sources in Settings > Security.
And when installing via Eclipse enable USB Debugging > Developer Options
Some tips:
http://developer.android.com/distribute/open.html
You can install .apk files directly to your android device using the following steps:
Write click on your .apk file and choose send to -> your device
You can access it using "Astro File Manager" (downloadable app from play store) also you can click phone menue button
go to "My Files"
Select your .apk file to install it.
I have build whole android source code...with the help of make command....for dream htc product...now i want to deploy those files(system.img,recovery.img,userdata.img,boot.img) in my real device htc t mobile g1...how can i deploy those files....?
I assume you're just starting out with Android, in which case it would be very wise to use the Android Development Tools Plugin for Eclipse, which I'm guessing you're not doing currently.
Once you install that, deploying to your application to your Android device is as simple as right clicking the project in Eclipse, and selecting "Run As -> Android Application".
Note: make sure you enable debugging on your phone: "Settings -> Applications -> Development -> USB debugging".
I guess what u wanna do is create a flashable zip file and install it via recovery,
You need to get the Android Kitchen (provided you have a Linux box or else you have to install cygwin on windows)goto http://forum.xda-developers.com/showthread.php?t=633246
and download the kitchen execute the .menu and you'll find a really long menu that may help you to package the files into a flashable zip file,
and since you are using HTC Dream install the amon ra's custom recovery(you need to root the device first,install the universal AndRoot from play store and root your device)copy the file to your sdcard and rename it as recovery.img if you have a terminal emulator app goto the prompt and type flash_image recovery /sdcard/recovery.img and if you are having trouble with the flash_image binary install busyBox from app store and that should solve the problem,
and after the recovery had been installed goto the terminal app or adb window then type reboot recovery or turn on the device by holding home key and in the recovery window do a complete wipe and select the option flash zip archive or something, browse the zip file you have created using the kitchen from the sdcard and select yes wait for the process to complete. hope this helps you
I made an Android Hello world app and I'm trying to load it onto my HTC Incredible. I believe it has 2.2 (how do I confirm that?)
Anyway, Eclipse gives me this message and then brings up the window in the screenshot below.
Automatic Target Mode: Unable to
detect device compatibility. Please
select a target device.
I'm on Ubuntu 64bit if that matters. I did turn on USB debugging on the phone. I told the phone to connect as a disk drive.
Any ideas how to get my app onto the phone?
Update: Do I need to perform these steps since I'm on Ubuntu? I doesn't mention what to do for Ubuntu 8.10 though.
Ok, it turns out I did have to follow all the instructions from this page. (The sudo stuff mentioned in other answers above didn't help.)
Here are the exact commands I ran for Ubuntu 8.10
You need to run the adb server in superuser mode (i.e. sudo adb start-server).
Try what EboMike said, run sudu adb start-server.
To answer your question "how do I confirm my phone is V2.2?" Press your phone's menu key, then settings, about phone, software information. The Android version is the number you're looking for. This shouldn't be important though for your hello world example.
Also, it's not important that you have the phone connect as a disk drive; this causes the SD card to be dismounted. It will actually cause problems if you run or debug an application that tries to access the SD card. You can just select charge only and use ADB/Eclipse's DDMS perspective to move files to and from the phone.
Here's an update answer in case anyone finds this thread from Google.
http://dimitar.me/how-to-connect-your-android-phone-to-ubuntu-to-do-developmenttestinginstallations-or-tethering/
The easiest way to this: Go to www.dropbox.com and sign up for a free account. Copy your .apk file from your project's /bin directory to your Dropbox. Download and install the free Dropbox app from the Android Market. Navigate to your .apk file on the Dropbox app and click it to download and install on your phone.
These are the steps I took on Arch Linux to resolve the same problem:
As mentioned in some of the other replies you will need a udev rule for the device. In this example I am using an HTC Desire.
(for HTC you'll need to use "0bb4")
Get the correct Vendor and Product IDs
run lsusb with the handset plugged in and you should see something like Bus 001 Device 004: ID 0bb4:0c87 High Tech Computer Corp. Desire (debug)
'0bb4' is the Vender ID: HTC
'0c87' is the Product ID
Make a udev rule using the values you've just retrieved
Now make a udev rule as root using:
$ sudo vim /etc/udev/rules.d/51-android.rules
Add the following (this is for HTC Desire - edit accordingly):
## Rule for an HTC Desire Android Phone
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87", MODE="0666", GROUP="users", NAME="HTC Desire"
GROUP defines which Unix group owns the device node.
At this point I rebooted and found that my handset was detected. Supposedly you can reload udev rules using the following but if this doesn't work try rebooting.
$ sudo udevadm control --reload-rules
in eclipse: go to Run menu -> Run configuration. Right click on android application on the right side and click new. Fill the corresponding details like project name under the android tab. Then under the target tab. Select launch on all compatible devices and then select active devices from the drop down list. Save the configuration and run it by either clicking run on the run button on the bottom right side of the window or close the window and run again
Cheers !
I have written a simple android app and it runs in the emulator.
Now how do I actually copy it to my phone? I have HTC's Eris. When I attach it with USB it asks me If I want to mount it as a USB mass storage device. I then see it in my drive list.
the directories on the device are:
albumthumbs
amazonmp3
com.google.android.apps.listen
ComicReader
data
DCIM
download
media
music
rosie_scroll
Now what should I copy from my Project directory and where should I put it?
And is there any other process I need to run to "install" my app?
The adb tool provides a command for installing an application onto the phone, adb install .... It takes the .apk file as an arguement. adb --help has a bit more info.
If you are running Eclipse, you can setup Eclipse to publish the application to a connected device.
http://developer.android.com/guide/developing/device.html
You can also simply copy the .apk file to the sdcard and navigate to it using a file manager such as Astro. Long press on it, and Astro will install it for you.
You should be able to use HTC Sync, if you are on Windows..
At least for Hero, it will automatically install APK files on my phone, when I double click them
Download: http://www.htc.com/us/support/droid-eris-verizon/downloads/
Install ADB driver. Have your phone in USB debugging mode. In an opened eclipse code press ctrl+F11. it will show your device. Run through it