Android Studio project doesn't run on devices - android-studio

Currently I'm making some android applications by Android studio.
My application working on emulator so fine but when I generate apk file for install on android devices any project doesn't run and they crash.
I tired to search for find answer or suggestion for fin this problem but I didn't find anything.
Can you tell me how can I fix this problem?

Related

Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again

Edit: tns run android works on android-studio ide but not on vscode. I got it running in android-studio by clicking the configure in the picture below:
I'm new to nativescript and android studio scene and configuring things out is really a hell of an experience, I got this existing project that I got running yesterday and when I try to run it again today with tns run android it now don't see the emulator that I have installed and the same emulator it used to run just yesterday. Here are the details of my config:
Installed Packages:
Path and Environment configuration:
Now if I run tns device android --available-devices this show up:
And it still insist that it cannot find any devices when it just found one!
Running tns-devices can't find it as well:
It also says All is good when I run tns doctor:
So my question would be, what am I missing here? Is it a missing package? Is it a wrong android configuration? Do I have to reinstall android studio from the start (Already did this twice!)
What worked for me:
restarted my unit.
ran the emulator from android studio.
ran tns run android on vscode.
and it just worked. Also, this might help you as well.

How to run an app on an iPhone simlator with Android Studio on mac?

I want to get started with flutter. I have downloaded flutter and the Android Studio and XCode. In Android Studio, I can select the ios simulator from the drop down menu, but all that does is turn the simulator on and doesn't actually run my app. I am not sure what else do I have to do?
Open your app on Xcode, xcode will configure somethings. When you compile from android studio to an iphone emulator, xcode compiles the project, so it needs to configure the project at least once. You may need to go to the project's ios folder and run pod install to install the ios dependencies.

Android Studios error : Unable to locate adb location

I'm new to Android Studios. After trying to press play on my Pixel 3a device emulator on AVD Manager this pops up. Error Message : Unable to locate adb
However my emulator runs just fine, I just can't run the "flutter run" command and the flutter app on the emulator. Emulator
I'm on Android Studios 4.0. Here's what I've tried so far to solve this issue.
AVG Antivirus
I added the adb.exe path in the exception section of my antivirus. AVG Antivirus
Android SDK Location
I went to SDK Manager, pressed edit beside the Android SDK Location box. All SDK components are already updated. Android SDK LocationUpdated SDK Components
SDK Platform Tools
I unchecked and checked SDK Platform Tools on SDK Tools.
Platform Tools
I've tried everything but still no luck. It's been a week and it's getting really annoying. I really do hope someone can help me. Really much appreciate it. Thanks in advance 😊
I've been tearing my hair out about this since I updated to v4.0 about an hour ago! :) This is what worked for me in the end (the other solutions about stopping starting adb server etc. just didn't work at all). YMMV.
Go into SDK manager, and uninstall :
Android Emulator
SDK platform tools
SDK command line tools
Close SDK manager and/or android studio completely.
Make sure the directories for these tools under AppData/ .. /Sdk have all been removed properly. Just zap them if they haven't.
Restart Android Studio and re-install all these packages.
I did another stop/restart after this, just to be sure.
Step 3: Profit!
Seems that upgrading the existing packages maybe didn't work properly, even if AS thought it did.
Still seem to be having issues using the geolocator package now (which was working fine before, so thinking this is setup too), but the emulator is starting OK now with no adb issues.
I tried reinstalling Android SDK after deleting the platform-tools dir but with no success. What did work for me were the following steps:
In Android Studio go to File > Project Structure (Ctrl + Alt + Shift + S in windows);
Under Project Settings>Project>Project SDK must have a valid Android SDK selected;
emulate a new device;
check if the adb daemon is running and recognizes the emulated device: open cmd prompt, run %ANDROID_HOME%\platform-tools\adb.exe devices and it should list the device you have on atm.
If you already have installed the Sdk tools at ~/Android/Sdk, you can add this to your .bashrc or .zshrc, alias adb=/home/USER/Android/Sdk/platform-tools/adb (change USER to your user) and restarting android studio, not invalidate caches/restart but closing it and re-opening it, which should pick the new adb alias from the shell.
The answers didn't work for me. So I removed/uninstalled everything and install a new android studio.
How to remove android studio correcly:

Android Studio not showing Chrome as Flutter device

I got a small problem which accured after reinstalling Android Studio:
Android Studio
Android Studio is not showing Chrome as Device for my Flutter Web project, while flutter doctor shows clearly everything is enabled correctly:
Flutter doctor
I can normally run the flutter project on google chrome using the console or VS Code, but Android Studio does not work. I already checked the Flutter and Dart plugin.
I would be glad if someone who maybe had the same issue or knows how to fix this gets back to me!
Best Regards
Clearly it is not the issue with flutter. It is an issue with your Android Studio installation. You can verify the same by navigating to the your project folder in the terminal (or command prompt) and type
flutter run -d Chrome.
NOTE: The above command works only if you are on master, beta or dev branch and you have already enabled your flutter web support by typing
flutter config --enable-web
I noticed that your path to Android Studio as: C:\Program Files\Android\ Android Studio1
It means that during installation the original Android Studio folder is not deleted. A duplicate folder has been created in the same location. Hence the Android sdk location is must be changed as well.
You can solve this by:
Uninstall Android Studio. Delete the folder at the above location. Reinstall Android Studio. Update sdk path in your sdk manager as well as in your environment variable. (recommended).
Update the sdk folder in the sdk manager as well as your environment variables.

Problems with setting up Android Studio with Flutter on Mac

I made my project on Windows computer, now I'm trying to export to ios on friend's Mac. I've been following this tutorial from part 1 all the way to part 5. How to Install and Setup Flutter for App Development on Mac - Part 1. In other words, Xcode is installed, Android Studio with Flutter and dart plugin installed as well. Android Studio recognizes both simulator and plugged iPhone. When I open the project in Android Studio it looks like this:
Note: Both flutter folder and the project folder are located in "exportalex"
Please try to use terminal and hit this: flutter pub get
You need to load all the dependency before run app.
If still you are facing same issue, please run: flutter doctor
Then share screenshot of result.

Resources