Xamarin.Forms: deployment issue after Visual Studio upgrade - android

After upgrading Visual Studio Professional 2019 to version 16.9.2, when I try to deploy on Android Emulator
api 28 (9.0), I get following error:
Error XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher. Please disable fast deployment in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.
Before the upgrade, everything worked fine. This is really frustating!

To correct this problem I had to
uninstall app on Android phone (important step)
Unload Android Project from solution explorer
This brings up the project file code now search code for
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
Change false to true save
reload project problem solved.
Note leave fast deploy checked.

Go to >> Solution Properties>> Android Options>> Uncheck "Use Fast Deployment(debug mode only)"

I had the same issue recently after adding images to my project found out that I had upper case letters as a name SomePicture.png renaming all images to lower case solved it.

#AlwinBrabu, I think you meant "Project Properties" -> Android Options -> Uncheck Fast Deployment(debug mode only).
This worked for me, although this is a workaround. I do not consider it a solution.

To solve this, I had to right-click on the Android project in the Solution Explorer, then in Options -> Android Build uncheck the Fast Assembly Deployment option.
Then deploy the project on the Android emulator.
But after deploying it once, I went back to the settings and checked (i.e. ticked) the Fast Assembly Deployment option, and subsequent deploys worked fine.
I'm running Visual Studio for Mac 2022 version 17.0.1 (build 72).

Related

Where did the "Profile or Debug APK..." option disappear to in Android Studio 3.4.1?

Android Studio used to have the option to debug existing APKs from the File->Profile or Debug APK. I have used it in Android Studio version 3.4. Now at version 3.4.1, I cannot find it.
Does anyone know if the option was removed from Android Studio or where can I find it?
I had this same issue and here's how I solved it.
I had disabled APK and NDK support in hopes that it would speed up my IDE. I forgot to turn them back on. So I went into Preferences > Plugins and if you don't have them installed, install Android NDK and Android APK support. If you already have them installed, tick Android APK Support and it will prompt you to enable Android NDK Support if you don't have it enabled already.
Since Android Studio menu can be customize, by some way the option has been removed from your toolbar. To add it again go in File -> Settings -> Appearance & Behavior -> Menus and Toolbar
From here open the Main menu -> File -> File Open Actions folders.
Select the Open line, then click on the plus sign on top of the window next to the search bar. Click Add Action... and search for Profile or Debug APK... options.
Apply and you're good to go !
Edit
After some exchanges in the comments we fixed the issue another way.
You have to go into Settings -> Plugins first. Check if you have the plugin Android APK Support activated/installed. If not then install/activate it.
And now you're really good to go !
That's weird because I am using android studio 3.4.1 and its there:
When I had problems after updating android studio all I did was to re-install it and my problems got fixed.
Also, you should know that downloading another version of Android studio is really user-friendly, check my question about it.

How to disable Instant Run for Android Studio 3.0

After making a few changes I am getting an error
Session 'app': Error Installing APKs
According to some it is because of Instant Run.
On the latest Stable Android Studio 3.0, under Build, Execution, Deployment I don't have any option for Instant Run, even checked in the settings search. Any clue where I might be able to disable it?
Update 1: Tried reinstalling. No change.
Build number 171.4408382
Update 2: Gave reset a shot https://stackoverflow.com/a/19397632/1926621 still nothing.
Update 3: Not a duplicate. Must be something in the settings. A complete clean install/reset did it.
Screenshot of what I see:
Go to Android Studio Settings or Preferences (for MAC) -> Build,Execution,Deployment -> Instant Run.
Then deselect the "Enable Instant Run" checkbox at the top.
Linux Screenshot:
Windows Screenshot:
For Mac go to Help in MenuBar and type 'preferences'
or,
go to 'Android Studio -> Preferences' in MenuBar
Mac ScreenShot
Instant Run is not a feature of Android Studio 3.5 (and later) any more and so cannot be disabled.
In case you find an old guide recommending to disable it, you can ignore this instruction.
See here 1 and here 2.
Just make sure you go to Android Studio -> Preferences instead of File -> Other settings -> default settings.
Instant run should be there.
Instant Run is removed from Android Studio 3.5 and added Apply Changes which works for Android 8 and above please follow the link for more https://android-developers.googleblog.com/2019/08/android-studio-35-project-marble-goes.html
Finally fixed!
As other users on Linux and such saw the Instant Run option in the settings, I tried reinstalling and resetting the installation, following https://stackoverflow.com/a/19397632/1926621
Removed all old settings, and installation of Android Studio( kept the SDK files). Changed the path. Opened the same project, and the options were now there!
Easiest/Laziest option for For mac would be CMD+SHIFT+A Search for instant run, click on relevant suggestion and uncheck the checkbox
Instant run is not a feature in Android Studio Bumblebee anymore.

Android Studio: Application Installation Failed

I've been trying to learn how to use Android Studio but when I attempted to run one of the sample programs I get this error message:
Installation failed with message null.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
I've tried to do this on 5 more sample programs and all of them give me this error. Does anyone know how to solve this?
I'm Using Redmi 3s mobile. I got same problem.
Solution: This issue is common on Xiaomi phones running MIUI 8. This can resolved by turning off MIUI optimizations from Developer Options in Settings app. Then recompile the app and voila it works.
Settings --> Additional settings --> Developer options --> Turn Off MIUI optimization
Or
Settings --> Developer options --> Turn Off MIUI optimization
I got the same problem , just choose clean project then rebuild project from build menu , it's solved my problem
Disable Instant Run
Preferences > Build, Execution, Deployment > Instant Run
Source: comment by #user77309
Path: Android Studio Preference / Build, Execution, Deployment / Instant Run
Go to Android Studio Preference (for Mac) or Settings (for windows)
Choose Build, Execution, Deployment tab
Choose Instant Run
Uncheck Enable Instant Run to hot swap code/resources changes on deply (default enabled)
It works for me!!
Go to Settings > Applications. Probably you have the app still installed for other users (I had the same problem with a Moto G, I did not see the app among other apps, but it still was among my apps in Settings). Try to find it and remove for all users.
If the problem is this one you will find the app at the end of the list (in Settings > Apps > All)
All the apps marked as "Not installed" are still there and you can not install the same apps with Android Studio until they are there
This happens when your app is using any library and there is also an app installed in your device that is using the same library.
Go to gradle and type:
android{
defaultConfig.applicationId="your package"
}
this will resolve your problem.
INSUFFICIENT_STORAGE
Solution:clean you phone storage
Pay attention Android Studio log:
open: Permission denied
open: Permission denied
pkg: /data/local/tmp/com.example......... Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
Step 1: Go to "Setting" → find "Developer options" in System, and click.
Step 2: TURN ON "Verify apps over USB" in Debugging section.
Step 3: Try "Run app" in Android Studio again!
and you should also TURN ON following fields inside "Developer option" .....
1: TURN ON ->"Install via USB" field
Some solutions:
1 Build -> Clean Project
2 Build -> Rebuild Project
3 Built -> Make Project
4 Remove your application from device and try install again
5 Mb you have some problems with actual version of yours app(try to pull actual branch). Also you can check on your emmulator, if yours app is running.
6 Try to use 1,2,3,4 solutions.
The solution for me was : (in a Huawei)
Android Studio -> Build -> Clean Project
In the phone -> go to Phone Manager -> Cleanup and Optimize
I had the same issue, and found that it was the USB cable I was using that was causing the issue.
Changing the USB cable fixed the issue, and I could successfully install the app afterwards.
In real device do below tasks..
1.clean all cache memory.
2.check the internal storage space (if space is just 500 mb free, then remove some data or app in the internal storage maintain at least 1 gb space.
3.again do clean all cache memory.
4.now goto android studio or eclipse click on app goto run select the device and run
I hope app will install and it will run..!!!
Uninstalling from AVD worked for me. After reinstalling it worked
For the 1st time installation of apps in a device, enable developer option which is mentioned in the above post. For facing problem while installing the apps from the tool, follow the below steps....
By enabling an option in settings, you can install apps directly. Error will disappear.
For MI users: Go to Settings-> Additional settings-> Privacy-> Unknown sources (make it enable)
For Normal Users: Go to Settings-> Security -> Unknown sources (make it enable)
Simply closing Android Studio (and emulator) then re-opening fixed it for me. Once I ran the app again, the apk re-installed successfully and app ran properly.
Recently I also find the same problem and there some reasons behind this but I am giving you 3
In your phone in the setting go to "Developer Option" and enable USB debugging
Also, check the "Install via USB" is also on in Developer Option itself.
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Instant Run and uncheck the Enable Instant Run
It must work.
Happened to me as well:
At the first time, it says-
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
At the second time, it says-
DELETE_FAILED_INTERNAL_ERROR
This because of the new 'com.google.android.gms' version 8.3.0
Changing it back to 8.1.0 solved the problem in my case
I was having the same error, but i fixed it after reinstalling the HAXM. This problem is caused because of the virtual device not starting properly. If your device keep showing on screen "Android" or the screen is black, it have not started yet, you have to wait more for it to start properly, then it shall run. If it is too slow, maybe you should find a way to accelerate the Android Virtual Device (AVD). The Intel computers have the HAXM (hardware-accelerated-execution-manager).
In my computer was not starting because of the HAXM not working, I fixed it by reinstalling the HAXM, downloading it from the intel website: "https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager"
Then i set the HAXM max memory to 1536MB in the installation, for not having the problem of this other post, that you maybe have and i was having too: "HAXM configuration in android studio"
After all done, it worked fine.
android {
buildTypes {
debug {
debuggable true
}
and
In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.
https://developer.android.com/studio/run/device.html#setting-up
it works for me..
I solved the issue by simply deleting my whole /build folder and rebuilding (menu Build > rebuild project).
This problem cause to me because of the project path .
Y:\Example&SourceCode with & sign
So i change the Project path to another one without special characters. Now It is Fine.
For me it only started working after I rebooted device (Motorola-Nexus-6).
(I also tried to clean, disable "instant run", reopen Android Studio, verified installed applications to be sure there are no clashes, disable and reenable Debug mode in phone, reconnect USB cable)
I have faced this issue since I have upgraded the build tools from 26.0.2 to 27.0.3. Reverting back, clean and rebuild solve the issue.
Also I have degraded the gradle plugin version from 3.1.3 to 3.0.1 as the latest version was overriding the build tools to latest version.
I also got same problem while generating signed APK. Just select APK signature scheme v1, not v2 (introduced in in Android 7.0). If you select v2 scheme it won't work on devices that use Android versions older than 7.0.
if your "versionCode" in build.gradle file is less than the eralier version code then, your app wont install.
Try to install with same "version code" or more than that.
If you do all of things above and still get stuck, just try reopening your Android Studio.
I had the same issue but finally it worked after storage clean on my mobile. May be happen because of insufficient storage
I have a Redmi K20, the following is MI, Redmi specific that I learned in a hard way
How I ended up in the error: I uninstalled the debug app from the phone because my assets were not accessible (maybe I had faulty source code)
Solution (steps that worked for me in sequence):
Uninstall the app
As per suggestion above by #Jayaprakash G and all, I turned off MIUI optimization
I tried finding "Instant Run", but seems missing in Android Studio 3.6.2
MI supports "Second Space", switch to it. You'll observe the app is still there. Again uninstall.
Switch space back to original again. By any chance, if you see the same app in frequently used app in the app drawer, again uninstall.
Try to compile and run the app from Android Studio and let it show in the app phone (Error 3 will be still there, but installation will succeed).
Clean the project, close Android Studio
Start Android Studio, now everything will work as normal without the Error 3
I solve this problem by:
Enable Instant Run
Settings>Build, Execution, Deployment>Instant Run

Visual studio can't debug Android Xamarin app

I've started with Xamarin and Android using Visual Studio 2013.
When I start debugging the android app, it builds, deploys to device and then debugging in Visual Studio stops. I can't hit any breakpoint. App is working in device, but I cannot debug it.
Am I missing something?
I've tried various emulators and a physical android device but debugging doesn't work in any of them. It just act like I have stopped it.
Debugging the same solution in Xamarin Studio works, I just can't get it working in Visual Studio.
I was having the same problem and I found this workaround with Hyper-V in Xamarin's documentation: https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/debug-on-emulator/visual-studio-android-emulator/
TL;DR; Open Hyper-V Manager -> Go to settings on your emulator -> Go to processor settings -> Select Compatibility -> Mark the "Migrate to a physical computer with a different processor version" checkbox -> Done! (At least for me) VS is now debugging my Android App
Another reason why Visual studio can't debug Android Xamarin app with a Hyper-V is due to you don´t have 'Deploy" option check in android project.
Steps: 1) Enter in "Solution properties" 2) Select "Configurarion Properties" 3) Check "Deploy" in Android project.
Make sure you are running on Debug mode (on target).
Then, check the Properties of the App Project and see if it's using the Xamarin debugger instead of the VisualStudio Debugger.
Enter in "Solution properties"
Select "Configurarion Properties"
Check "Deploy" in Android project.
Open Hyper-V Manager
Go to settings on your emulator
Go to processor settings
Select Compatibility
Mark the "Migrate to a physical computer with a different processor version" checkbox
This will also happen if you don't have any activity marked as your main launcher activity:
[Activity(
...
MainLauncher = true,
...)]
public class MainActivity ...
Easy mistake to make if you're shifting code in from a prior project and the prior project is using a splash activity and your new project is not yet doing so.
Go to property of app project then click android option and checked checkbox in debugging section.then run again.
For anyone who might still need help. Also make sure the build and deploy checkbox's are checked in the configuration manager. .
In my case, after some investigation, I saw I was having this warning: "Failed to read .android.dll' with debugging symbols. Retrying to load it without it. Error details are logged below. 2>Mono.Cecil.Cil.SymbolsNotMatchingException: symbols were found but are not mathing the assembly"
The solution was to disable linking:
Right-click the Android Project -> Properties -> Android Options -> Under "Linker properties", set Linking to None (see image below)
Got this from TedFalasco's answer on this post.
Hyper-V manager can't be installed on Windows 7 (only the management tool gets installed) so if you get this problem, following those steps don't help.
Here is the thing that worked for me and it's mentioned here as an answer but hasn't been marked up or marked as an answer. This is actually the best and easiest solution. nothing else worked for me.
In Visual studio, make sure you choose the solution file (not project files) in the solution explorer. Then go "Project > [project]properties"
in the left pane choose "Configuration Properties > Configuration"
Now check the Deploy feature if possible. Only deployable projects have the option.
This saved my life and I almost gave up on Xamarin. I really hope this helps others like me.....
In my case, the warning was self-explanatory:
Set the debugging information to Portable in the Visual Studio project property pages or edit the project file in a text editor and set the 'DebugType' MSBuild property to 'portable' to use the newer
In other words: Right click on project => properties => build => click on advanced => set the debugging information to portable.
I have tried every answer and none of them worked.
Here is what I did to make it work again:
Plug your physical android device to the computer. Android device must have Developer options enabled.
Choose your android device in Visual Studio.
Run app in Debug mode. Your app should appear on your android device.
Unplug your android device from computer.
Try running your app in android emulator. For me Debug option starts working again.

Cannot start Android Studio. Android Studio stuck at the splash screen

I am not able to start the android studio. I have set java path in environment variables and Android studio is also latest version. I have tried to install and run administrator but no help.
Please help me...
Open file Android Studio setup directory/bin/idea.properties
Add disable.android.first.run=true to tail
Restart AS.
Going through the Known issues page(https://developer.android.com/studio/known-issues) found me the fix.
You have to set these additional PATHs
ANDROID_HOME = your SDK directory (android-sdk)
PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Actual Solution
None of the answers here specify on how to debug the problem, you need to run the bin\studio.bat script in the terminal and inspect the actual Idea exceptions in order to fix the problem.
No need to re-install, delete precious configuration (and plugins, etc.). Just read the error message!
For me, this was the issue:
ERROR - llij.ide.plugins.PluginManager - java.net.BindException: Address already in use: bind
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind
This means the plugin manager is trying to listen on a port that is not available. Is something listening on that port? For me, it is the stupid "excluded ports" by Windows, so I simply stopped the service:
net stop winnat (as administrator), and confirmed that Android Studio started to work.
Don't delete your configuration files, especially if you don't want to re-configure your settings. Just read the log provided by the bin\studio.bat script.
As of January 2016, the most recent canary needs the property written as as:
-Ddisable.android.first.run=true
otherwise it complains about missing JAVA_HOME. (using windows 10)
Fixed mine android studio by changing the system language, you can set yours to English go to Control Panel->Region under formats tab change the format to English(United states).
I had the same issue, I fixed it by changing the system language. Set your language to English by going to the Control Panel/Region. In the Formats tab change the format to English(United states).
I upgraded my Android Studio from 3.0 to 4.1 and after that AS always stuck on the splash screen. Fortunately, this section of the known-issues works for me https://developer.android.com/studio/known-issues#studio-config-directories
Fixed my Android Studio by changing the system language. You can set yours to English by going to:
Control Panel->Region
Under the formats tab, change the format to:
English(United states)
Thanks #ravi this also worked for me
As of March 2022, I was stuck in the splash screen was due to a plug-in conflict, but the IDE wasn't warning about it.
I received a warning balloon saying that I had the ExcelReader plug-in installed, suggesting me to install the new ExcelEditor plug-in, which is an improved (and paid ¬¬) version (I knew later). So I went and installed it and the IDE suggested restarting.
After restarting, the IDE always got stuck in the splash screen every single time I tried to launch it.
It wasn't until an hour later and so many launch attempts that, miraculously, the IDE launched and a dialog showed up warning about both plug-ins being not compatible so I had to disable one of them. It was a shame that it didn't warn me before. So I chose which one to disable on the dialog and it worked again.
Therefore, I suppose that if this were to happen again, it could be solved by editing the file /home/$USER/.config/Google/AndroidStudio2021.1/disabled_plugins.txt and adding the plug-in to the file manually.
In my case it was "com.chesterccw.excelreader" what I should have added. After that, of course, I uninstalled one of the plug-ins.
Studio doesn't start after upgrade
If Studio doesn't start after an upgrade, the problem may be due to an invalid Android Studio configuration imported from a previous version of Android Studio or an incompatible plugin. As a workaround, try deleting (or renaming, for backup purposes) the directory below, depending on the Android Studio version and operating system, and start Android Studio again. This will reset Android Studio to its default state, with all third-party plugins removed.
For Android Studio 4.1 and later:
Windows: %APPDATA%\Google\AndroidStudio<version>
Example: C:\Users\your_user_name\AppData\Roaming\Google\AndroidStudio4.1
macOS: ~/Library/Application Support/Google/AndroidStudio<version>
Example: ~/Library/Application Support/Google/AndroidStudio4.1
Linux: ~/.config/Google/AndroidStudio<version> and ~/.local/share/Google/AndroidStudio<version>
Example: ~/.config/Google/AndroidStudio4.1 and ~/.local/share/Google/AndroidStudio4.1
For Android Studio 4.0 and earlier:
Windows: %HOMEPATH%\.AndroidStudio<version>\config
Example: C:\Users\your_user_name\.AndroidStudio3.6\config
macOS: ~/Library/Preferences/AndroidStudio<version>
Example: ~/Library/Preferences/AndroidStudio3.6
Linux: ~/.AndroidStudio<version>/config
Example: ~/.AndroidStudio3.6/config
Note that the configuration directory for Canary and Beta releases of Android Studio is PreviewX.Y instead of X.Y for the . For example, Android Studio 4.1 Canary builds use AndroidStudioPreview4.1, instead of the AndroidStudio4.1 directory that is used for Release Candidates and Stable releases.
https://developer.android.com/studio/known-issues
just add this line disable.android.first.run=true at the bottom of the idea.properties file in the bin directory of the installation folder

Categories

Resources