Running on Android Studio on my Mac is becoming impossible - macos

I have a 2019 MacBook Pro 13" with a 10th gen i5 and 8 gb of ram. Whenever I try to run android studio on my Mac. My life becomes a nightmare. If I even try to change some of the preferences, it just stops responding, and the weird part is that everything else keeps running perfectly, there are absolutely no issues with any other app running while android studio is frozen I am learning how to code and use such programs and I have no idea why this is happening when I've seen people use 6-7 year old MacBook Airs to run it and it works. I have no plugins installed, just the basic out-of-the-box settings. Can someone please help me.

Android Studio freezes on macOS Big Sur
On machines running macOS Big Sur, Android Studio 4.1 might freeze when you open a dialog.
To work around this issue, do one of the following:
Go to the Apple Menu, select System Preferences > General. In the
Prefer tabs when opening documents option, select "never". Then
restart Android Studio.
Upgrade to Android Studio 4.2, currently available in the Beta channel.
As mentioned by Android Studio Itself

Related

Can't run a Xamarin App in iPhone Simulator from Visual Studio For Mac

In short: I am unable to run my app in the iPhone Simulator. There is no "Play button" (the triangle), only a Debugger button (hammer):
As you can see above I have "Generic Simulator". When I click on it, there is no list of various iPhones/iPads to choose from:
If I choose Android, I am able to run the app:
I have XCode installed. I ran XCode once.
I also installed the Command Line tools.
I created a new Xamarin Forms App:
Here are my iOS build options:
I am able to run the Simulator separately:
Creating an App in XCode and running in the Simulator works:
info.plist:
Prefrences -> SDK Locations -> Apple
Build -> Configurations:
Here is the kicker though. If I run a Xamarin App on my Windows machine using the iPhone Simulator on the Mac, it works!
What do I need to do so I can run my app inside the Simulator vis Visual Studio for Mac?
Few options you can worth to check. #WorldOfBasti suggested options plus following.
Configuration
Right click on the solution -> options -> Configurations -> Configuration manager -> ProjectName.iOS with Debug|iPhoneSimulator should be checked or if configuration "ProjectName.iOS with Debug|iPhoneSimulator" is not available then add this from General tab
Apple SDK path
Check Apple SDK path is set properly (Preference -> SDK Location -> Apple). It should have green tick mark with Xcode version and SDK path location.
Minimum system version (Deployment Target)
Change Deployment Target to minimum version (ie, lower than your simulator version)
Switch debug <-> release
Today I have also faced same issue which you are facing. I have switched debug to release, iOS to Android. Then reverted back to iOS and debug from the top device selection status bar. Then Simulator option was appearing. So, might be UI updated issue in Visual studio for mac. Please give a try.
I assume that you tried the basics things like restarting your Mac, etc. So here are a few things, that might solve your problem:
Check your build configurations, here is a good video
Close VS for Mac, start Xcode and create a test project which you run on a simulator. If it works try again in VS for Mac
Close VS for Mac, goto Xcode -> Preferences -> Accounts and download the manual profiles of your developer account. Try again in VS for Mac
Clean your project: In VS for Mac, goto Build -> Clean All. Then Close VS for Mac, goto your project folder and delete in "yourprojectname" and "yourprojectname".iOS all bin and obj folders. Try again
If all of this doesn't work, I would try to reinstall it (if you have any important projects, make a backup):
Uninstall VS for Mac and Xcode
Install Xcode again from the App Store
Install Visual Studio for Mac
Hopefully it works..
Looking at the Visual Studio for Mac logs, specifically the IDE log, I found this line ... 'The target name of simulated device could not be added because it's already cached'.
You are welcome to read through all of this ... but you may just want to go down to the Addendum 2 (final?) and see if that works for you ... it ends up being simpler and quicker than anything else I have found.
So, at first, I started clearing the cache with a 'xcrun simctl erase all' command from Terminal, and when I started Visual Studio for Mac I could run a Xamarin App, but launching the simulator took quite a bit of time.
So hare's something I found works that you might want to try ...
Close iOS Simulator on Mac (if any).
Close ALL copies of Visual Studio that are connected to the Mac ... either on the Mac itself or on another computer connected to the Mac (if any).
Start Visual Studio for Mac.
If you can't run a Xamarin App, Close Visual Studio for Mac.
Launch the Simulator manually (I have it in the Dock, so I just click it) ... wait for it to fully startup.
Now close the Simulator (from the Simulator menu).
Now restart Visual Studio for Mac.
If you still can't see the simulator devices to run on ... try the above steps one more time (this time you should only have to close Visual Studio for Mac followed by manually starting the Simulator, waiting for it to start, and then quitting the Simulator and finally restarting Visual Studio for Mac).
It still isn't great, but this has (so far) always worked for me. And the Simulator starts up substantially quicker then if I did a 'xcrun simctl erase all' command from Terminal.
Addendum: Most of the time the above works. But occasionally I still have to clear the cache from the Terminal with 'xcrun simctl erase all' command.
Also: I have also found (although maybe it's just my imagination) that clearing out the Visual Studio for Mac temporary .binlog files that are written in the 'T' folder will sometimes fix the problem (if you look at an IDE log from Visual Studio for Mac; right after the 'The target name of simulated device could not be added because it's already cached' message, you should see some .tmp files being created. The directory where they were created is the 'T' folder I'm talking about). I sometimes delete the tmp*.binlog and tmp*.tmp as a last ditch effort before using the 'xcrun simctl erase all' command to try to get back to where Visual Studio for Mac will see the iOS Simulator Devices.
Finally: This is really starting to feel like a bug in Visual Studio for Mac startup (or possibly during a iOS project load). The reason I say that is I can ALWAYS see the iOS Device list from Visual Studio for Windows (as long as I can connect to the Mac). In addition, I can leave Visual Studio for Mac running (even hidden) and test an app on the iOS Simulator from Windows, then, leaving the iOS Simulator Running on the Mac, run an App on Visual Studio for Mac. If there really were a 'caching issue' with the Simulator it seems to me I should have problems running anything on the Mac after using the iOS Simulator from Windows, but it always works. For now, I'm working on a single Xamarin Project on the Mac (and I don't use the Mac for anything else), So I just let Visual Studio for Mac 'open at login' (Dock setting) and automatically 'load previous solution on startup' (Visual Studio for Mac setting), hide Visual Studio for Mac (Dock Setting) and if I need it, Visual Studio for Mac is already loaded and able to see iOS Devices to run Apps on with a quick click on the Dock Icon.
Addendum 2 (final?): I have now found that if I just close a solution that I have open that shows 'Generic Simulator' and re-open it without exiting Visual Studio for Mac (sometimes I have to do it multiple times ... I think I've counted up to 5 times before it finally worked), it will start showing the device list and I can run the iOS app in the Simulator. I don't even have to close the Simulator if it's already running, which saves a bunch of time.
It still feels like a bug to me, I don't see why I would have to close/open a solution multiple times to get the iOS devices listed and be able to run an iOS app. What really gets me is if I reboot the Mac, don't open the Simulator and start Visual Studio for Mac, then open a solution, I still have to go through the close/re-open solution steps... sometimes more than once. The simulator is not set to auto start or anything like that. But, at least, it's getting simpler, and takes less time, to get to a point where I can run an iOS app.

How to overcome "Please select a valid device before running the application." on a paired with Mac Visual Studio on Windows 10

I have a Win10 computer paired with Mac. Until today all things were okay, but today I start getting the message:
Please select a valid device before running the application
when I try to debug an iOS Xamarin application on a selected iPhone simulator.
My configurations:
Mac:
OS: Mac OS Catalina, version 10.15.7
XCode Vesion: version 12.2
Visual Studio 2019: version 8.8.4 (build 30)
Win 10:
OS: Win10 version 10.0.19042.685
Visual Studio 2019: version 16.8.3
Simulator names are available on my Win10 computer, but when I select one and try to debug an iOS application I get the message I reported above.
If I launch debug on the Mac directly it runs and starts debugging on the selected iPhone simulator. But when I do the same on the paired Win10 computer in Visual Studio I get this message.
I searched google and SO for this issue and according to advises downgraded XCode to the most possible version 12.2 that is supported by Visual Studio. But it does not change anything.
I want to debug application only on simulator on the paired Win10 computer.
Is there a way to fix this issue?
Looks like the problem was related to the connection between my Win and Mac computers.
My steps to resolve this issue:
I opened Tools - Options - Xamarin - iOS Settings on Visual Studio on my Windows computer. On the Pair to Mac dialog window I selected "Forget this connection" (right click context menu on the connection).
Next, on my Mac, I turned off Sharing (System - Preferences - Sharing).
Then I restarted my Mac computer. And then turned On sharing again, specifying my username as allowed users.
Next on my Windows computer, in the Visual Studio, on the Tools - Options - Xamarin - iOS Settings section I paired my Mac again.
Voila. All things work as expected!
If anyone else runs into this question today, I found this GitHub issue for XCode 13 issues with Xamarin.ios
https://github.com/xamarin/xamarin-macios/issues/12778
I fixed the issue by manually installing xamarin.ios-15.0.0.6.pkg on my mac (linked in the GitHub issue)
When connecting to mac through visual studio it showed the error "The Xamarin.iOS SDK version '15.0.0.6' that is installed on the Mac is not compatible with this version of Visual Studio. Would you like us to install Xamarin.iOS '14.20.0.25' for you? This will overwrite any other existing Xamarin.iOS installation on your Mac."
But, if you hit cancel it should still connect successfully.
Same issue diff version. VS MAC stand-alone also had some issue as VS WIN connected to VS MAC. Started at some early today. Suspected an update somewhere. Traced issues to auto update of XCode to 13. Solution was to download and reinstall XCode 12.5.1 from Apple Dev site. With XCode 12.5.1 things worked. So, something changed with the API in XCode and Xamarin was not prepared for it.
Restarting Visual Studio in Windows worked for me after successfully building.

Will Android Studio work on Mac with an ARM processor?

Will Android Studio work on Apple with arm chips ARM (the new Mac devices)?
Good news !
Edit on May 2021 🎉 🌈
Apple Silicon Support
There is an arm64 version available for Android Studio Arctic Fox (2020.3.1) Canary 15 ... Beta03 You can download it here https://developer.android.com/studio/archive
NDK builds doesn't work
First post
Android Studio 4.1 works, but I'm not able to make Emulator work.
Even the ARM image shows me a CPU does not support VT-x
I can confirm, this preview of Emulator works properly https://androidstudio.googleblog.com/2020/12/android-emulator-apple-silicon-preview.html
Since v3 even audio-out works (no audio-in)
Update March 2021
You can simple use one of these and it's working out of the box
For most programming, the chip "underneath the hood" doesn't matter. It only matters if you're working very low-level.
To support old and new apps, Apple will use Rosetta 2, integrated emulation software, to enable ARM-based Macs to run Intel code
The IntelliJ issue for ARM support
The pull request for ARM support on IntelliJ
Intellij (and Google to a lesser extent) has a financial interest in making sure that it does work. Emulation might be slow, but I would be shocked if the IDEs and other tools aren't recompiled to work pretty soon after the release.
Edit: Their IDEs already work on ARM-based Chromebooks, which hopefully means there's little work in making it work for ARM Macs
And on the bright side, emulators will probably be faster?
Android Studio supports it starting at Arctic Fox 2020.3.1 Canary 15. The related ticket.
Android Studio is Basically InteliJ with the Android plugin enabled by default, so if you're impatient, you can use the M1 build of IntelliJ and enable the Android plugin here.
Currently, this has an issue with the bundled sqlite-jdbc not being compatible with Apple Silicon. To resolve this:
Download sqlite-jdbc 3.34.0 or later at https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/
Go to finder > applications > right click on "Intellij Idea" > "show package contents". Go to Contents>lib and replace the old sqlite-jdbc.jar with the latest downloaded sqlite-jdbc.jar file.
Go to https://github.com/google/android-emulator-m1-preview to get an M1 compatible emulator.
I am using Apple Silicon(M1) Macbook and running Android studio on it. There are 2 things -
Does Android studio work on M1 - YES, it is using Rosette2 to convert android studio binary for ARM. And performance is pretty impressive.
Do i have emulator for M1 - YES, download "Android Emulator M1 Preview2" of emulator from here - https://github.com/741g/android-emulator-m1-preview/releases/tag/0.2
Steps:
Double click the .dmg. It will open folder
Drag and move emulator file to Applications
Right click on emulator file and click open. It will show developer security message. Bypass that from "Security & Privacy" window on Mac.
Right click and Open. And it will launch the emulator.
There are few issues with emulator that will resolve in future releases. You can read more on google page - https://androidstudio.googleblog.com/2020/12/android-emulator-apple-silicon-preview.html
In android studio, you will see this emulator as "Virtual device" in running device drop. Select and run your app.

debugging XAMARIN forms apps doesnt always work - why?

I'm trying to finish a XAMARIN Forms project for a client and the whole time I've had issues. The biggest annoyance (really too many to list) is that when trying to debug using the iPhone simulator the debugger fails to hook up. Is there a trick I'm missing?
My setup:
I'm working on a Windows 10 workstation with a Mac Mini setup as my build server. I'm using Visual Studio 2017 Enterprise Edition. The Mac has the latest XCode and XAMARIN Studio stuff installed.
Everything is up to date
Right now the only 'solution' seems to be to stop the debugger in VS and start over.
Occasionally I have to close VS all together, reboot the mac and start from scratch.
Is there a trick? A checkbox somewhere that says "make this work like it should"?
1) are you in Debug mode on not Release ?
2) can you try on real iOS device ?
3) have you try on Xamarin Studio instead of Visual Studio ?
4) does it work on Android (simulator or real device) ?
5) have you try with a new clean project ? if it works try to remove bin & obj folders

Menu bar not showing in Android Studio

I have a problem with my Android Studio app on macOS Sierra.
It seems like the app is not really open, because usually, when an app is open, there is a dot under its icon in the dock, but on my computer there is none...
The true problem is that the menu bar options like "File", "Build", ... don't show up, and I can't access them. Instead I have the options of the next open app. Once again, it looks as if Android Studio were not open. It's very annoying because I can't use all the tools.
Except these problems, I can edit my code, I can launch an app on a device using a USB wire, etc. It's very weird, and I haven't seen any similar issues on the Web. I tried restarting the app and restarting my computer, none of these worked...
Have you ever experienced the same problem with Android Studio (or with any other app)?
This was fixed by Apple. Upgrading macOS to 10.13.2 Beta 4 (17C79a) resolved the issue for me.
According to IDEA-175658 this is a known bug in High Sierra. But it seems to be a bug of Java and not Jetbrains products.
The workaround by the time being is installing Apple legacy Java 6 runtime. I can confirm it works over here.

Resources