I'm trying Xamarin Live Player, using Visual Studio 2017 Preview 3, following this link to setup: https://developer.xamarin.com/guides/cross-platform/live/install/. It seems to work for simple apps. However:
I couldn't get the DependencyService to work, it just couldn't resolve the dependencies, registered by adding [assembly: Dependency(typeof(implementorType))] attributes on the implementation classes.
Furthermore, in iOS apps, when I placed a break point in AppDelegate -> FinishedLaunching event, the break point seems to be unreachable, could that be the reason that has caused the DependencyService broken?
Related
unfortunately this question was closed however it is spot on. Let me go through the steps as I am reproducing a legacy app issue that uses httpclient so switching is not an option YET (6 months out maybe).
create android studio app
try to use Httpclient and as he shows in the post above it is in red
I try to add this line in build.gradle to bring it in as a work around(even though core android also brings it in)
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
Then I get this error in android studio
`httpclient` defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for `httpclient` use `HttpUrlConnection` or `okhttp` instead), or repackaging the library using something like `jarjar`.
Ok, so I am using the wrong version so I run build scan and I see this so I bring this one in instead of the other version (android studio now sees HttpClient and can import it at this point)
I still get the same error though about conflicting android libs.
QUESTION: How do I fix the red in my legacy project and not have this error either?
My best bet seems to ignore the error. Will I have issues that I am not seeing though in the future?
I had android studio and it was perfect without any problem. Everything was going right until I reinstall my windows to make PC a little faster. And then I install android studio the latest one. And though the last one was also up to date, there were no problem at all. But, in the new android studio any project I start or any project I open which has constraintLaoyout, the design view of xml get stuck with following errors.
Rendering Problem
Failed to find style 'coordinatorLayoutStyle' in current theme
Second error when I put any widget or anything on my activity
Missing Constraints in ConstraintLayout
This view is not constrained. It only has designtime positions, so it
will jump to (0,0) at runtime unless you add the constraints The
layout editor allows you to place widgets anywhere on the canvas, and
it records the current position with designtime attributes (such as
layout_editor_absoluteX). These attributes are not applied at runtime,
so if you push your layout on a device, the widgets may appear in a
different location than shown in the editor. To fix this, make sure a
widget has both horizontal and vertical constraints by dragging from
the edge connections.
First, update your project to use the latest build version. This helps fix a lot of problems when it comes to most Android views.
Second, go to your style and add this line of code to fix the first error
<item name="coordinatorLayoutStyle">#style/Widget.Design.CoordinatorLayout</item>
Third, the children of CoordinaterLayout must be constrained, if you are new to this layout, you can switch to RelativeLayout or you can use the design view to add constraints. View the official documentation here
A helpful video on constraints HERE
I found the implementations of dependencies in build.graddle(Module: app) were API 28 but there was only API 26 in following directory
C:\Users\[username]\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\appcompat-v7
So I deleted all SDK platforms and build tools and installed them with API 26 in SDK manager(select Show Package Details).
Then I started new project. The projects made with API 26 had no rendering problems.
Have you tried adding design library in your build.gradle?
If not then just add it
implementation 'com.android.support:design:23.2.0'
Finally solved the problem. Writing this answer so that other can get help form similar kind of problem.
By default when we create a new project in android studio, it uses the latest API from SDK. In my case it was API 28. But, API 28 was incomplete or partially installed. I tried installing the API 28 completely but it did not work for some reason. Then I deleted that API 28 and installed API 27 latest. And by doing this when I create or open any new project that uses the API 27 and gets all the required things in there. And that is how I solved my problem.
Thanks everyone guys who tried to help me.
I'm developing an app for iOS and Android with mvvmcross but now I have following problem...
In my Core PCL I must done some operation depending on which is the App Store of download.
For translation I have resolved using custom json, TextProviderBuilder and to get language
System.Globalization.CultureInfo.CurrentCulture.ToString()
Now I'd like to have information on store that must be different to language.
UPDATE
As suggested by Cheesbaron, that is a platform issue that must be resolved in each View. Than how it's possible to access to that information on Xamarin Android and iOS?
This should be pretty straightforward, but can't work this out for myself I'm afraid!
The following line of code triggers the error:
using Microsoft.Xna.Framework.Storage;
Error: The type or namespace name 'Storage' does not exist in the
namespace 'Microsoft.Xna.Framework' (are you missing an assembly
reference?)
But as far as I can tell, I have added the reference: (Solution explorer -> right click References -> Add reference -> .NET tab -> scroll down to Microsoft.Xna.Framework.Storage -> select it -> click OK).
Microsoft.Xna.Framework.Storage shows up when I expand "references" in the solution explorer.
What am I missing?
EDIT
Okay on second look this might be to do with how I'm adding the references. When I search in the object browser Microsoft.Xna.Framework.Storage doesn't show up (but when I search, for example, for audio, Microsoft.Xna.Framework.Audio does show up). Is there anyway to check that when I click "OK" on the add reference pop-up that it is actually working?
I see two likely possibilities.
You have a mismatch of XNA 4.0 and XNA 3.1 (or previous) references in your project. If the Storage reference you added is from 3.1, you'll get this message. You can try removing it, and then looking specifically for the 4.0 version during add.
The device you are building for may not support the Storage mechanism. In particular, Windows Phone apparently uses a different storage mechanism (System.IO.IsolatedStorage http://msdn.microsoft.com/en-us/library/ff604992.aspx).
Hope one of these helps.
This question was asked a long time ago, but if anyone else is still looking for an answer, here is how i fixed it.
If you installed the Microsoft.Xna.Framework references by using the installer from Microsoft, then it installs in C:\Windows\Microsoft.NET\assembly. I found all of the Xna libraries in GAC_32 and Microsoft.Xna.Framework.Storage in GAC_MSIL.
You can also use the GAC to find libraries that aren't in Visual Studio's reference list. For .NET Framework versions before 4.0, the libraries are in C:\Windows\assembly, and the libraries for versions after 4.0 are in C:\Windows\Microsoft.NET\assembly.
It's actually been removed from Monogame by Microsoft.
Running: Windows 10, with integrated graphics card (Intel G45/G43), Visual Studio 19, Monogame 3.7.1
Project Structure: Solution > Game.Shared, Game.Android, Game.OpenGL (followed this guide on creating a Cross-Platform project, method number 3).
I changed the Target Framework in my OpenGL project from .NET 4.5 to .NET 4.7.x (the newest version), and I was able to build and deploy the app to an Android device. Do this by clicking the project and selecting Properties.
I simply commented out the line. App will successfully deploy to an Android device this way. The game will then deploy, but I can't get any content to load.
Have yet to see if I can deploy to an iOS device, I will update this post when I figure out if I can.
No nuGet's installed.
I have a static class that uses
System.IO.Path
System.IO.Directory
System.IO.File.
Currently, the class is in my iOS project and unchanged also in my Android project.
I created a PCL that targets Android and iOS only.
However, neither one of the namespaces is available.
I presume that is because iOS and Android alone are not suitable for a PCL profile and that's why Windows Store 8 or Silverlight 5 gets added and that removes the System.IO.* namespaces.
Is this working as designed? Is file linking my only chance in this case?
Yes, for now this is the way it's supposed to work. You can use something like my PCL Storage library to access the file system from a PCL, or you can simply use file linking.
As a side note, I'd recommend choosing Windows Store and .NET 4.5 along with the Xamarin targets. That profile is going to give you more APIs than the one which targets Silverlight 5 which you get by default when you just choose Xamarin platforms in that dialog.
System.IO.Path, System.IO.Directory and System.IO.File are partially supported in PCL profile EXCLUDING silverlight 5: WP8 + NET4.5 + Xamarin + iOS.
Path.Combine works perfectly in this targeted PCL.