After updating my project to Xamarin Forms 5.0 I cant run it on my phone. I tried a blank Xamarin Forms 5.0 project and it worked, but my real project prints "Deployment was successful to [Device]" but nothing happends. It installs the app but it is corrupted or something, because the app is not visible on home screen, but exists in "settings > app" with no icon (and the size 154mb as it should be)
I have no idea what causes this and have tried everything to make it run on my phone. When archiving it I get "Cannot create archive file because the copy of mdbs files failed"
I get no compile errors when I press Build -> Build solution
I have tried deleting the app via adb/system and reinstalling it via vs.
I have tried removing the obj and bin folders and rebuilding.
I have tried rebooting and reinstalling android sdk.
I have tried restarting the android abs server
My phone is android-28 and the minsdk is 21, targetsdk is 29
(Xamarin.Forms v5.0.0.1874, Xamarin.Essentials v1.6.0, Visual Studio 2019 v16.8.4)
full build log when trying to debug: https://pastebin.com/dgqQvh24
1>Deployment was successful to [DEVICE].
This issue was caused by an invalid AndroidManifest.xml file. Simply removing a duplicate tag caused the build to succeed. For some reason xamarin forms 4.8 ignored this in the building process, but xamarin forms 5 "Failed to parse Activity Name" because of the duplicate tag.
For anyone expericing this issue just fix the AndroidManifest.xml
Related
I have an app that is build using React and is wrapped in capacitor. I was having no issues running the app in debug mode on android studio a month ago, or creating release files, but now I am.
I have checked the app-debug.apk (static/js/main.chunk......) file that is created when I select run, and it contains the updated code, I have sent the package to a colleague who ran the .apk on their machine and saw the updated code, but on my emulator and on my android devices, I am seeing an old version of the code.
I have removed all debug-release.apk files on my Mac and followed steps online such as clean build/rebuild, updates off mac, android studio etc but still no luck.
I am at a complete loss now.
Any ideas?
Thanks
Update: After much troubleshooting, we deleted the build folder android>app>build and the rebuilt the app, and ran it, and it fixed the issue.
After migrating my project from Xamarin.Forms to .NET MAUI as instructed by this article, I could deploy it to Android Emulator just fine, but when I pushed it to a new branch in Gitlab, clone it to a new local folder and deploy it to Android Emulator, I got this error from the cloned project solution's Output window. The build was successful, but not so for deploy.
1>------ Deploy started: Project: x.Android, Configuration: Debug Any CPU ------
1>Please select a valid device before running the application.
1>Deploy failed
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
My OS is Windows 10 and I use Visual Studio Community 2022 Preview (ver. 17.3.0 Preview 1.1). My Android Emulator is Pixel 5 - API 31.
I'm aware that similar questions have already been asked multiple times, but most of them were dedicated for iOS and I couldn't find the solution for Android. I've tried rebuilding my solution, unchecking and rechecking all the checkboxes in Configuration Manager, updating Android SDK, factory reset my emulator, and restart Adb server, but none of these worked.
I've also checked my selected emulator and from the looks of it, VS 2022 Preview detected my emulator just fine
as shown by this image
Outside of this project solution, VS 2022 Preview can run .NET MAUI projects without problem, with my Android Emulator's name replacing the "Start" button. Additionally, I can also switch between two Android Emulators (before I deleted one) when I open natural .NET MAUI project solutions, something I can't do for this migrated project. The dropdown just closed without doing anything, with check mark on the left of my emulator's name not moving to the newly-chosen emulator.
I'm not sure whether it's caused by VS 2022 Preview, my emulator, or my migrated project. Any help would be appreciated.
I had the same issue. What resolved it for me was setting <SingleProject>True</SingleProject> in the Android .csproj file.
I could not find much documentation on the issue. Apparently, this tag is meant to declare that the project is using MAUI's Single Project philosophy instead of Xamarin.Forms. https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/single-project
Even though my project came from a Xamarin.Forms migration, this tag seems to work.
I had the same issue, in my case Visual Studio did not add the .csproj.user file for my project automatically
I had to add this file to the git (and also edit it because I had different emulators on the other machine).
When trying to run the app on the device, I'm facing the following issue:
I the Event Log, there is the same message:
Where can I find more info about the error?
Might work if you Clean the project or rebuild the project and if you launching in emulator uninstall from the emulator or from mobile.
UPDATE:
i think there will be no more information about the error...
It's our common mistakes.
As per my knowledge about this issue there can be a few reasons for that:
First is that your app is already installed with the same package
name but with different certificate, To resolve this check if your
phone has that app already installed then uninstall it and try to
install new one.
The second reason can be that you are trying to install the
application that has minimum SDK version higher than the Android
version of device. To solve this make sure that the minimum SDK
version defined in your project's "build.gradle" is lower than the
Android version of your device.
Turning off the Instant run removed error for Android Studio 2.3.
sometimes project location contained the special character.
Example: E:\Android_Projects\T&PUIET,KUK\app\build\outputs\apk\app-debug.apk
close android studio > rename folder containing the special character(here T&PUIET,KUK ) > restart android studio.
Hope it will help!
I have tried literally everything to try and rectify this error when trying to deploy an app to an actual android device for debugging but have been unable to solve the matter. Everytime I try to launch I get a failed [INSTALL_FAILED_DEXOPT] error and when checking the logcat it is always because there is no classes.dex in my debug apk.
If I run gradlew.bat clean assembleDebug, there is no difference in the apk size so I'm assuming there is a build error in android studio. I am using android studio beta 0.86 and have tried it on 0.89 with the same result. I have tried build tools for 19.1 to 21 with no result. I have also tried different devices and created a new project (that has never been installed on my devices) and android studio seems to think it needs to be uninstalled first when attempting to deploy.
I have tried switching my device to ART, uninstalling and reinstalling android studio, redownloading the sdk and restarting my computer. NOTHING and I mean NOTHING has worked. I think the problem started after I downloaded the lollipop apis but am not sure. I have tried uninstalling all apps with my package signature on my device but NOTHING works! Not even Project -> Clean Project -> Rebuild
This is extremely frustrating as I cannot debug my apps anymore :/ has anyone had any experience with this error or ways to rectify it?
So turns out that the issue was mismatching sdks between Android Studio and the Project. The project was using an old sdk and once I made them the same, I cleaned and rebuilt the project and everything was good to go.
UPDATE:
I ran into the problem again after I tried to update my SDK and its tools. Turns out that when you try to do this, the SDK locks the tools folder and then you get an error saying some file couldn't be overridden. When this happened to me, all the build tools were deleted so there were errors in the .dex file created when debuggin my app.
We are using android 2.2 (really old i know) and couldn't find a fix for this error. Eventually we found this bug https://android-review.googlesource.com/#/c/30900/. The only solution for us was to remove some libraries...
I kept having the same problem - manually building worked fine, but Android Studio would not build a proper APK.
The problem was that I started the project on Android Studio and Android Gradle plugin version 2.0-beta2. After updating the Gradle plugin to 2.0-beta6 through a simple build.gradle change, the builds stopped working.
Turns out that, although I installed a beta version of Android Studio, the update checker only checked the stable channel. After setting the updater to check the canary channel as well, I was able to upgrade Android Studio to version 2.0-beta6 and builds continued to work normally.
You can change the update preference in Android Studio settings under Appearance and Behavior -> System Settings -> Updates.
I encountered this error when storage of the device is full. Try to open some space.
Try run these commands
adb reconnect
adb reconnect device
I am having this problem while running my application in emulator.When I run application it shows in console this error:
[ERROR]Error reading data file
and then nothing happens.Don't know what can be the issue, tried it many ways deleting all virtual AVDs and cleaning up the project again and again but not working anyway any solution for that? I am using 2.1.1 titanium SDK and android V8 (2.2).
sometime this also show this error in console:
[ERROR]No building apps, No launcher activity.
Did the application run before?
Have you tried a clean build or deleting the build directory to perform a full rebuild? You can also have a look into the logcat provided by DDMS to search helpful information.