Xamarin MonoDroid does not support running the previous version - android

I have just installed the Xamarin tools, installation went without any errors.
I have launched VS 2013 Update 4 Pro and created Blank App ( Native Shared ).
I did not modify code or project structure, just tried to run.
So i have changed the Startup Project to Adnroid project:
Then i have rebuilt the entire solution.
The console prompted Rebuild succeeded.
I have noticed that debugging button has a very long path, which is strange:
If i click on any option it opens the AVD Manager, but doesn't change the Start, to selected device.
So i have tried launching the Emulator from AVD manager and it works.
But when i click start in VS it prompts me:
Where is the problem? How can a newly installed app not work?

You project is most likely targeting lower version of android API. Try changing the target android version.

A note here should be that within Visual Studio/Xamarin the settings regarding supported version are within the solution settings of that project.
In this way you can change the version to support what you need, or if it is correct download a more current simulator.
This can be done with GenyMotion for instance or Xamarin Android Player.

This error message currently can be shown due to a large number of different issues.
Visit Build Failed. MonoDroid does not support running the previous version to learn about the different causes for this error message.

Related

Xamarin Blank Screen

I am trying to explore Xamarin, trying to create simple CURD project.
I was able to make some progress by watching youtube video's, but I am not sure what went wrong all of the sudden I am getting blank screen in my emulator when I am trying to deploy the project.
Firstly it showed me error stating
'the targetFrameWorkVersion is greater than my project version. You
need to increase the version for the project'.
I tried it, I increased my project version. This issue got resolved but gave birth new error.
Secondly
'To deploy this application, your deployment target should be running
Windows Universal Runtime version 10.0.16299.0 or higher. You
currently are running version 10.0.14393.2007. Please update your OS,
or change your deployment target to a device with the appropriate
version.'
I looked up for newer version of OS, but it seems my OS is already up to date.
I really appreciate if anyone help me out with tips or clue.
Environment is as follows
Visual Studio: 2017
Operating System: Windows 10
I am attaching ScreenShot of error
:
Try this
Set your android project as StartUp project
In your VS menu go to Build ->Configuration Manager
Uncheck the UWP project from both Build and Deploy, i hope your issue will be sorted.
first
its not your SDK, this is cause by old nugets in your project.
update all your nugets. at least xamarin.forms.dll
second
update your windows OS to latest. then
install appropriate microsft windows mobile sdk version. the link should appear when you right click your project and select install missing features
https://learn.microsoft.com/en-us/windows/uwp/updates-and-versions/choose-a-uwp-version

How to resolve : unexpected error occured Initializing Android Designer" in VS 2015 with Xamarin

Bringing up a new PC with Xamarin and VS 2015 Pro I received the following error:
An unexpected error occurred trying to initialize Android Designer.
Please verify the Android SDK path and the Java Development Kit path
on Tools->Options->Xamarin->Android Settings menu. Please see the logs
for more details.
I verified the SDK's are installed correctly. VS didn't generate any kind of Activity Log so I believe the log must lie elsewhere. Anyone know where I can find this log to find out more about what is wrong ?
I had exactly the same problem described (on a new PC, with a new Visual Studio install) and am 99.9% sure the answer is in how updates are applied. Or, more importantly, how they aren't being applied when you think they are.
Go to Tools | Options | Xamarin | Other, and under Xamarin for Visual Studio Updates, Check now for STABLE updates. Make sure you're running at least 4.2.0.680. You will have to close Visual Studio in the background as the updater is running--it'll warn you. Uninstalling and installing the cross-platform development tools from Visual Studio was not applying this update for me. I had to force the issue.
Now, as mentioned earlier, go to Tools, Android SDK Manager. I noticed my "Android SDK Tools" and "Cross Platform Tools" were out of date and updates were available. I accepted and applied the updates to version 24.4.1. BEAR WITH ME, THIS IS WHERE IT GETS TRICKY--it still didn't work.
Go back to Tools, Android SDK Manager. I immediately noticed that even though I'd just applied the latest update for "Android SDK Tools", (24.4.1), a new version (25.2.2) was now available, along with 17 other updates. I accepted them all.
Bingo. Where I once had the annoying error message and an empty design surface and an empty toolbox with the sad "no usable controls" message, I now have the attached screen snapshot--a design surface where I can see a visual representation of my .axml, and a toolbox from which I can drag and drop controls and they actually show up on my Samsung tablet.
Sorry so verbose. I lost hours on this problem and thought others might appreciate another working solution.
I had a similar problem as explained below.
Here a solution that worked for me:
1) delete the one package appearing in the screen shot below.
Nota bene: At this stage VS 2015 greyed out the Android SDK manager buttons, even after a restart.
2) download installer_r24.4.1-windows.exe for windows https://developer.android.com/studio/index.html
3) launch the Android SDK Manager outside of VS and install the proposed 19 packages. This time I could go through the installation.
4) Launch VS 2015 and create Xamarin Android project. Launching Main.axml would launch the designer properly on an android project.
The bug I had
I had the same problem here on a fresh install of Win10 + Full visual studio community 2015 update 3 + .Net Core + Azure SDK and Xamarin. Creating a new project Xamarin Native (iOs + Androird) shows up the same message as mentioned by MikeJ. In addition, running in debug F5 makes the designer have a new popup
Problem seems to appear also here
https://bugzilla.xamarin.com/show_bug.cgi?id=44374
and here
https://forums.xamarin.com/discussion/77669/how-do-i-fix-this-error-the-installed-android-sdk-is-too-old-version-25-1-3-or-newer-is-required
.
Opening the Android Manager does not show up version 25 as an option, instead it shows this
However, we cannot install (greyed out button even by accepting license)
Updating Xamarin did not work neither How to update Xamarin for Android within Visual Studio Community 2015
Some guidance would be great to understand what happened.
I had the same problem (when bringing up a new PC with Xamarin) and after a few days I solved the problem.
I moved sdk directory from "C:\Program Files (x86)\Android\android-sdk" to "C:\android-sdk". Then I opened the sdk manager and made updates. It's all.
I think the problem is with the path, which has space :)
I was able to to fix the issue by opening the Android SDK Manager and updating all the tools to the latest version.
If you are already using Android Studio in your computer then this might solve your problem.
Check whether SDK is already available at some other location. That worked for me. To check SDK path- Open Android Studio-> Click on SDK Manager Icon. Check Android SDK Location. Copy that path.
In Visual Studio-- Open Tools->Options->Xamarin->Android Settings menu and replace the new SDK path. It will automatically ask to download the updates. Install all packages and you are done!
before you go through all that trouble (and I went through many convoluted steps myself for several hours) please try run your VisualStudio as administrator and see what happens!
It solved the above issue (and then some) for me. I used fresh WIN 10 and VS2015 Community install and I must have set some of my permissions to tight.
Also I learned that updating my NuGet package: Xamarin.Forms (v.2.3.3.168)
solved errors related to:
System.MissingMethodException: Method Android.Support.V4.Widget.DrawerLayout.AddDrawerListener not found.
But that is another issue all together.
Adding these two references to Droid.csproj and packages.config fixed the problem for me:
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
Another issue to be aware of is that you need to have Java Development Kit 8 referenced in Xamarin, instead of JDK 7. You can set this is Tools > Options > Xamarin > Android.

Missing Visual Studio Android emulators from Cordova project targets

The last time I updated visual studio, I accidentally unchecked 'Android emulators' from the modules list, so they all got uninstalled.
Since I need them, I went and modified the installation from windows 'add or remove programs', checked and installed 'Android emulators' as a visual studio module, and all seemed fine.
But then, when I tried to build an Android version of my Apache Cordova app, I noticed that the Android emulators did not get added back to the target list. The Cordova project is set as a start up project.
I tried reinstalling the whole module and also reinstalling the device profiles, but they're still missing.
Is there a way to configure what devices/emulators show in that list?
Thank you.
So it seems like you are missing the Visual Studio emulators for Android, which we have pre configured to show a 5" and 7" option. A fresh install probably just missed that component (because its not automatically checked). Modify "Microsoft Visual Studio" from the Add or Remove programs menu, and check the VS Emulators for Android to add them to your version of VS. See the checklist image below for where the component is.
If you want to create a custom Android emulator yourself to show under "Google Android Emulator" (because that comes pre-installed), just make sure that your Google Android emulator is running the virtual device that you created, and on deploy your app should show up on that emulator.

Visual Studio 2015 Xamarin deploy fail without any error message

I just installed VS 2015, the installation was finish (after some fail time caused by the slow network, I run setup again).
I create a project as Android > Android blank project
When I press F5, the build is seem to by success but the deploy is fail, there isn't error message. Tried set Tool->Option->Build->Diagnostic, no result. VS 2015 is pretty new, is anyone met this? How can I fix this?
I bumped into the same, but I started VS2015 as Administrator and solved the problem.
Is any Android Virtual Device running?
Open AVD menu
Launch the device
Wait for it to fully load
Build and deploy
Find your app in device's menu and execute it
Visual Studio gets stuck trying to deploy the app to the emulator or the emulator does not appear as a debug target in other IDEs
If the emulator is running, but it does not appear to be connected to ADB (Android Debug Bridge) or it does not appear in Android tools that make use of ADB (for example, Android Studio or Eclipse), you may need to adjust where the emulator looks for ADB.
The emulator uses a registry key to identify the base location of your Android SDK, and looks for the \platform-tools\adb.exe file under that directory. To modify the Android SDK path used by the emulator:
Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the folder tree on the left.
Modify the Path registry variable to match the path to your Android SDK.
Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.
And yet another recipe of fixing this:
clean projects
remove all bin, obj folders
mark your android-project
as startup
then try to deploy again
As for me, in some cases, if visual studio stucked on project building, it requires pc reboot.
I had the same annoying issue. Going to Options -> Xamarin -> Android Setting and checking Preserve application data/cache on device between deploys solved my problem.
I was facing same issue.
Just reopen visual studio and rebuild your project..and then try to deploy.
Its worked for me!
According to Magnus Grindal Bakken's comment, I found the solution.
1) The installation must have an internet connection to be completed.
Any interruption may cause components to be excluded.
2) You need android emulator. Installing the Android SDK and Visual Studio 2015, is not sufficient, You either need the Microsoft emulator, the android one or another third party emulator (like Genymotion). You also need to ensure that the Xamarin plugins for Visual Studio are installed.
Xamarin for Visual Studio can be downloaded here. Once it is installed Visual Studio will be able to create and run Xamarin projects. Xamarin for VS includes the Xamarin Player for emulation. I think it's even better than Genymotion.
Start emulator via AVD manger ... [start] button (as user m93a suggested).
And next option contains check option "wipe user data". Check it !
It helps me solve this problem. Then deploy or debug the application and all process will works as expected.
I had the same problem with my XF App, it didn't deploy and just one message saying Deployment Failed, internal error....
I solved it. Working on Mac with Xamarin Studio, make sure that the ABI of your simulator is supported by your app.
Xamarin Studio Android project Options
Just run your Visual studio as Administrator mode.
Sometimes the physical Android device gets confused about versions.
On the device, to go settings | Applications Manager | All applications.
Manually delete your application.
Manually delete "Mono Shared Runtime" (don't worry it will reinstall during deploy)
Make any change in your project so it is seen as altered and needing to be recompiled: Add a new blank-line to a .cs file or something.
Build
Debug/deploy
I faced that problem couple hours ago, I tried to deactivate hyper-V and it worked for me.
In the Android App project Properties in Visual Studio I had to go to Android Options>Advanced and make sure the Support architectures had the architecture of my AVD checked.
In my case this was x86_64 (which, by the way, does not have a particularly discovereable method of installation - took me days).
First of all, we can find the error in "Details" when we click "Start" button on "AVD Manager" for "Android_Accelerated_x86". If the error is as follows :
Please ensure Intel HAXM is properly installed and usable. CPU
acceleration status: HAXM is not installed on this machine
So, in this case we need to install "IntelĀ® Hardware Accelerated Execution Manager". It can be downloaded from following link :
haxm-windows_v6_0_6.zip (6.0.6)
Note: After installing Xamarin for the first time in visual studio 2015 i had the same error to run "Android_Accelerated_x86". After installing this accelerated emulator is now up and running.
If the emulator does not even lauch, maybe deploy is skipped.
You cas see this in the output console.
If so, you may have to activate the deploy by checking it in the solution's (not project) parameters.
If the emulator launches but the deploy won't end after minutes, with no error, try the steps described here : https://stackoverflow.com/a/32564067/7505268
That solved it for me.
I had Xamarin Android Player opened while trying to deploy the Android project. This steps worked for me:
Closed Xamarin Android Player
Ran Android project again
in my case I had this problem because "Solution Configuration" was set to Release. I change it back to Debug and I solve the problem
Try one of the following and see if you can get the app to deploy to your device.
Clean and build project/solution
Make sure you have updated all the NuGet packages (Right click on solution and click on Manage NuGet Packages.... Then check in Updates section whether there are any updates)
Make sure you have installed all the necessary SDKs from the Android SDK Manager
Check whether you have selected the correct project as the startup
Check if you have set the correct path for Android SDK and NDK locations
Make sure you have checked Deploy for your selected project from Build -> Configuration Manager
Well there can be many reasons,one of them could be that from the Build section in your toolbar,if you check the configuration manager there will be project names that are available in your current solution all you have to check is if the deploy checkbox is checked or not.If not kindly check it and things will work just fine
This worked for me:
Making sure that Define DEBUG constant is checked.
Using Log.Info("yourTag-AnyString", "Error before/after ");
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
Log.Info(tag, "Error before Layout");
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
//Button button = FindViewById<Button>(Resource.Id.MyButton);
//button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
Log.Info(tag, "Error before variables");
userName = FindViewById<EditText>(Resource.Id.editTextUsername);
password = FindViewById<EditText>(Resource.Id.editTextPassword);
btnInsert = FindViewById<Button>(Resource.Id.btnInsert);
Log.Info(tag, "Error after variables");
btnInsert.Click += BtnInsert_Click;
}
changing emulators or exporting the signed .apk instead
For android apps, using android device logging
There is actually a connection between running Visual Studio as administrator and setting the registry path.
I followed the instructions here but it only worked after running VS as admin because my Android SDK path is in "C:\Program Files (x86)". So in order to add or change files there you need admin rights. Alternatively you can change the permissions of the "Android" folder so that the group "Users" as full access. This worked for me as well.
Or you make sure you don't even install the Android SDK in "C:\Program Files (x86)".
By the way I found that restarting VS, or even the Emulator again wasn't necessary after I added the registry key. It picks it up when it needs to.

Android Support Library not being detected by wizard - Cannot create MasterDetailFlow

I have created a few projects with the MasterDetailFlow using API 11 earlier.
I needed to add LoginActivity so I downloaded the needed SDKs and updated the SDK tools to rev 22.2
http://prntscr.com/1rzb9j
Now that it is updated, when I use the wizard to create a new MasterDetailFlow project, or when adding an Activity template such as LoginActivity (to my previously created project having MasterDetailFlow layout) it says that the Android Support Library is not available or is outdated.
http://prntscr.com/1rzbc5
This template depends on the Android Support library, which is either not installed, or the template depends on a more recent version than the one you have installed.
Required version: 8
Installed version: 18
I have tried Uninstalling and reinstalling via the Wizard, to no avail
(as advised here Not able to create new Project with ADT version 20)
After I uninstall and run the wizard- the Installed version shows "not available" and thus I click on "Install/Upgrade"; where it installs and shows that the Installed version is 18 but the next and finish buttons are disabled, and "Check Again" does nothing.
I have also tried manually installing also, going back to version 8, even then it says:
Required version: 8
Installed version: 8
Here too, the next button is disabled, and check again does nothing.
I repeated the above said solutions many times, and no luck. I am thinking it might be something else that is wrong. Any ideas?
Try google app inventor for creating android applications. Its easier and lot more simple.
Solved.
https://code.google.com/p/android/issues/detail?id=60149#c55
Hi everyone,
This one is my bad. I was in the middle of changing the dependency
system used by the templates and a transient state got picked up into
this tools build. The templates have settled in the AOSP master
branch.
I've attached a snapshot of the current Activities templates.
Replacing your sdk/tools/templates/activities folder with the contents
of this zip should resolve this issue.
I apologize for the inconvenience.
Download the given file and replace it with the templates, and it works fine.
install the platforms and extras in the sdk better install all there is to install in the sdk

Categories

Resources