How do i debug a device owner/device admin application? - android

I have a Xamarin Android app. I have used ADB to make it a device owner. I have also set it up so it requests DeviceAdministrator privileges. When i try to run the app from visual studio it, using the same signing key it was created with, it fails on the deployment phase saying it cannot uninstall the application. I know that DeviceAdmin privileges keep the app from uninstalling, but how does one then push from Visual Studio to debug the application?

Related

Will different machine installed Android app (via Android Studio) get a different signature?

I have an old app that I've written for personal use only, and never made as release to the Play Store. I installed it to my phone via Android Studio using run app command.
Many years later I want to modify the app, I try to pick up the app and run it again, this time using a different computer. I get the error saying:
"Installation failed since the device already has an application with the same package but a different signature. In order to proceed, you have to uninstall the existing application."
I definitely don't want to uninstall my app, this would cause me lost all the data I've entered to it. So I want to ask that isn't the debug keystore used by Android Studio to install app on device would create app of the same signature? Why it would be different? Is a different machine caused this issue? Thank you very much!
It sounds like you were using your debug certificate when you originally installed the app. This is unique to each machine when you install Android Studio.
You can copy the debug certificate from your old machine to your new one.
The file is located in your [userhome]\.android\debug.keystore

How can I fix Android app launch stopped error?

I have installed my android app in my device. But getting "Unfortunately, app has stopped."
How can I debug the installed app? Is it possible to debug the app directly installed in the device?
Since code is not available with me
You can't connect debugger to an application if it uses a release build type where all of the information necessary for debugging is stripped out
(true for apps from play market).
If you don't want to use a debugger but just to see logs you may see log in android studio or just by running adb logcat in terminal.
Android Studio 3.0 also has a feature of Profile and Debug Pre-built APKs but only if they were built with debugging enabled

replace apk with new one but different signature

Usecase
I normally always use the debug versions of my own apps on my own phone while developing them. Before releasing a new version, I want to test the release on my own phone. That's not very convenient, I currently have to do many steps:
backup the debug version of my app
deinstall the debug version
install the release version
restore the data of the debug version
Current solution
I do the above steps manually with the help of Titanium Backup on my phone...
What I want
Important: I want to use the data from my debug app in the release app, so that I can test the release build with all the data from my debug app
I want to automate that process. The best would be a batch file, I can use on my laptop while the phone is connected via usb. Currently all I found is following:
%adb% install -r app-release.apk
But of course this fails because of wrong signatures. So actually need to delete the apk from the phone without deleting the data and copying the new apk to the phone. Is that somehow possible?
Possible solutions
Replace the apk on my phone without installing the app
Copy all app data to the laptop, uninstall the debug version, install the release version and copy back the app data to the phone
???
You wil always have the signature issue. But if you deploy your application with android studio (or eclipse) it will be faster : use debug or release to build your application and deploy it to your phone (local data will be lost).
You may want to try this method from another stack user Android – multiple custom versions of the same app. TL;DR: if you use your application as a library you can deploy a debug and a release version at the same time on your phone.

Run Android wear app

I want to create an Android wearable app on Android studio. I have installed the apk file on mobile to test run it. I would like to know how I can run the same apk on wearable device.Also, apk file created on Studio is different for wearable and mobile devices. How can we run it? Thanks in advance!
As it mentioned at official website you need to create special package signed by release key. See more info about packaging here.
When developing, you install apps directly to the wearable like with handheld apps. Use either adb install or the Play button on Android Studio.
Note: The automatic installation of wearable apps does not work when you are signing apps with a debug key and only works with release keys.
During the development period, do not use release key for signing. Instead, you should build your app which would result in two apks, one for the phone and one for the wear device. Then install each of them separately on the corresponding device using adb or Android Studio. Make sure you are using the same package names for both apks.
When you are done with your development, then build the app with your release key; then the wear apk will be embedded inside your phone apk and installation of your phone apk on a phone will result in the installation of the embedded wear apk on the wear device (make sure you remove the dev apks from both devices prior to this step otherwise installation will fail due to different keys).
Trying to debug through Android Studio as suggested by Julia and Ali, but it is always showing me Parse error while installing or running the code.
I have created a project for both mobile and wear. While running for mobile it works fine in the mobile device but while running the code in the wear it always shows Parse error.
I am using Moto 360 for running and debugging.

Deploying Android App To Multiple Test Devices

I exported an unsigned apk file that represents a test version of my Android application. I need to distribute this to quite a few users. Is there a simple method to distribute the apk file where it will install the app? I'm trying to avoid the test users from having to download something like Astro or the sdk. Any ideas? I tried putting it out on a global web server and the file downloads but doesn't install. Thanks for the help!
From the android documentation:
The Android system will not install or run an application that is not
signed appropriately. This applies wherever the Android system is run,
whether on an actual device or on the emulator. For this reason, you
must set up signing for your application before you can run it or
debug it on an emulator or device.
So even if your users have the "Allow installing non-market apps" checked, your application will still have to be signed with at least a test key before it can be installed on a physical device.
I just put my experimental apps on the Android market with a description that says "don't install this, it won't work for you" and then give an access key to my testers.

Categories

Resources