Android studio runs my application without installing the app - android-studio

I am trying to make an application using Android studio 3.6.3 and my phone to test it. I had a problem and I thought it was a good idea to uninstall the app, but now, Android studio doesn't recognize that the app does not exist on my phone and it tries to run the MainActivity.class file.
The error is:
05/27 21:03:30: Launching 'MainActivity' on Xiaomi Redmi Note 7.
$ adb shell am start -n "com.example.liteshop20/com.example.liteshop20.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.liteshop20/com.example.liteshop20.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.liteshop20/.MainActivity }
Error type 3
Error: Activity class {com.example.liteshop20/com.example.liteshop20.MainActivity} does not exist.
Error while Launching activity
How can i trick it to reinstall the app properly?

I solved it going at right side Grandle>MyApp>Tasks>install>UninstallRelease
and then Run the App again so it builds properly.

Related

Failed to create install session with 'cmd package install-create -r -t --full -S'

I am getting an error when trying to run any app through Android Studio after upgrade to 3.5.1.
Installation did not succeed.
The application could not be installed.
Installation failed due to: 'Failed to create install session with 'cmd package install-create -r -t --full -S 2123967' '
I have found similar posts in StackOverflow, and these error messages seem to provide additional information or recommendation. However, the error message I get does not provide any other information. I have tried all the solutions I can find, but was not successful. Here is what I tried.
Clean uninstall (deleted all related files/folders) and reinstall of Android Studio
All apps fail to launch, even a new empty project created with no changes
Disable Instant Run (Option does not exist any more) / Update drivers / Update SDK / Rebuild the project / Sync with Gradle / Run Invalidate caches/restart
Launching to physical android device yields same installation error message
Emulator itself launches and functions without any issues
For this workstation only, problem started when I upgraded Android Studio, but it was a big jump from prior version as I did not run it in this workstation for months and months
I am open to any suggestions or ways to get any additional information to troubleshoot.

Android Studio 3.4 waiting for application to come online

Since upgrading to AS 3.4 I can no longer debug any of my apps. I have made no changes to any of the projects, I just upgraded AS. Now all I get is "Waiting for application to come online".
When I click on Run->Attach Debugger To Android Process, there are no processes to attach.
The apps load and run, but I cannot debug them.
Is there anything I can do to get the debugger working?
(I have tried clean, rebuild, invalidate cache and restart, make project and gradlew clean).
I found the same trobles in Android Studio Dolphin (2021.3.1) when created a new project with no activity. After the project creation I created a main activity and add a launcher intent-filter and tried to debug it. And found "Waiting for application to come online". I found that "Launch" argument in "Lunch Option" for my "Run Configuration" is "Nothing". Problem solved by changing it to "Default Activity"
To change run configuration option select Run->Edit Configurations, or "Modify Run Configuration" in Run or Debug panel.
I had the same problem, I tried: Update Android studio to 3.5, restart cache, delete cache folders, killing adb server and restart it... but nothing works.
I solved executing the next commands on ADB terminal:
On windows, you have to change to platform-tools folder path in order to excecute ADB commands, something like this:
cd C:\Users\YourUser\AppData\Local\Android\Sdk\platform-tools
Then, compile your app on debug mode. (I think shift + F9 on Windows), when you started to see "Waiting for application to come online" message, execute the next adb command:
adb shell am start -n com.example.yourPackage/com.example.yourPackage.MainActivity -D
Just change com.example.yourPackage and make sure MainActivity its your Luncher Activity inside your Manifest File.

Device emulator-5554 disconnected (with no Emulators on Android Studio)

I get an error while trying to run any app on a physical device.
Device emulator-5554disconnected, monitoring stopped.
Error while Installing APK
It works after trying at least 3 times, but sometimes it gets frustrating.
I tried to delete all the emulators and reinstall Android Studio but it didn't help. and the set deployment target is always flashing like so:
flashing emulator error
In my case it looks like Docker interferes with adb.
I tried restarting Android Studio, adb kill-server && adb start-server, and anything else I could think of.
Then I tried killing all docker containers and quitting the docker app, and everything works nicely again! Edit: Killing the containers is enough
I'm wondering if this is a newly introduced issue in Android Studio/adb/Docker - I updated to AS 3.4 recently, and I don't remember having this problem in the past, but it could have just been a coincidence.
I tried the suggestion but it didn't work, after a few days of work on it, I found out that a vpn software (SoftEther) that I had installed was causing the problem, uninstalling it solved everything.
it seems adb was interfering with a network bridge the software was trying to create.
Try restarting the adb.
Use the following command to restart adb
adb -d kill-server && adb -d start-server
Use command -d for real device and command -e for emulator in case both are connected
Also if that doesnot work clean the project and reset connected emulator.
Run Emulator and wait for the home screen of the Emulator to load
Click Window > Open Perspective > DDMS
In Devices Panel, click on drop down menu > Reset adb
Run project

React Native Could not create ADB Bridge Error

JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Download https://jcenter.bintray.com/com/facebook/react/react-native/0.20.1/react-native-0.20.1.pom
....# a bunch of downloads here
:app:assembleDebug
:app:installDebug
05:13:20 E/adb: Unable to obtain result of 'adb version'
:app:installDebug FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: Could not create ADB Bridge. ADB location: D:\Android\sdk\platform-tools\adb.exe
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I'm using Windows machine and the android studio and have followed the tutorial over at
https://facebook.github.io/react-native/docs/getting-started.html
I'm stuck at this as i cannot run the 'react-native run-android' on command prompt
Also, running adb version gives
Android Debug Bridge version 1.0.32
Revision eac51f2bb6a8-android
I have solved this problem ..if you are using emulator then follow React-Native, Android, Genymotion: ADB server didn't ACK... if you are using your device over usb for development then it is an error of your adb path.. set the path to D:\Android\sdk\platform-tools... in pc properties->advanced settings->environment variables->system variables..it worked for me.
I have another solution, If you are using emulator then make sure its running before you start you react native app. Some time you may need to close the application(like skype) those are using same port:8081(default used by react native application) before running react native app.

Sign Application in Android Studio

I am a web developer and I recently decided to learn how to build apps in Android, using the first-party IDE Android Studio.
I spent a few days designing a tutorial app, which I managed to run in an emulator, and then I've been programming and designing the layout for my own app.
However, I've been running into a problem when I try to test the app.
Waiting for device.
Target device: emulator-5556 (Nexus7_2) Uploading file
local path: C:\{file_path}\{app}-release-unsigned.apk
remote path: /data/local/tmp/{app_name}
Installing {app_name}
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/{app_name}"
pkg: /data/local/tmp/{app_name}
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
By looking up this error online, I've figured out that I need to sign my app, but I haven't figure out a way for this to work in the case of Android Studio. Modifying the ant build.xml file doesn't work and other methods of signing don't seem to work either.
There is an option to Generate a Signed APK, and I exported an app that was signed. However, I cannot seem to put that apk into my emulator.
If there is anyone more knowledgeable about how to use Android Studio, I would appreciate the assistance in how to sign my apk with the software. Thanks.
Output from Tutorial App
I copied all the code that wasn't included with the new project. This application does work in the emulator.
Waiting for device.
Target device: emulator-5556 (Nexus7_2)
Uploading file
local path: C:\{file_path}\QuoteReader-debug-unaligned.apk
remote path: /data/local/tmp/{app_name}
Installing {app_name}
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/{app_name}"
pkg: /data/local/tmp/{app_name}
Success
Launching application: ...quotereader.MainActivity.
DEVICE SHELL COMMAND: am start -n "...quotereader.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat= [android.intent.category.LAUNCHER] cmp={app_name}/.MainActivity }
I have found that if you delete the app on your phone then it should work when you run it again.

Resources