Open Moulikaattili opened 5 years ago
Are you using the screenlet with Xamarin or native Android?
Using it with Xamarin
I'm not sure that you can instantiate the screenlet directly... can you use https://github.com/liferay/liferay-screens/blob/develop/xamarin/Samples/Showcase-Android/Activities/LoginActivity.cs as a reference on how to use it in Xamarin?
I am already using it, but it didn't work.
Can you use the screenlet that way? by referencing it from a resource file instead of instantiating it?
Can you please elaborate this? And also is it possible to use life ray screenlets commonly for both iOS and Android. As all the tutorials we checked used liferay separately for iOS and Android in Xamarin forms. Below is the error I am getting while trying to add liferay screens for android separately.
"All packages and projects are compatible with MonoAndroid,Version=v8.1."
And this is the error I am getting while adding liferay screens commonly for iOS and Android.
"Checking compatibility for Microsoft.NETCore.Platforms 1.1.0 with .NETStandard,Version=v2.0. Incompatible packages: 1 Package restore failed. Rolling back package changes for 'sampleLiferay'."
Xamarin errors... @dgarciasarai can you look at this?
Can you please elaborate this? -- Right now you are instantiating the screenlet with code, but that is not very common in android because it doesn't hook with the lifecycle of the activity...
To work you have to instantiate with a layout, the xml file, like this and reference it in your java code with findViewById, like this:
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.LoginView);
loginScreenlet = (LoginScreenlet) FindViewById(Resource.Id.login_screenlet);
loginScreenlet.Listener = this;
//Comment this method if you want to test LoginCheckPasswordView
setDefaultValues();
}
@Moulikaattili Liferay Screens NuGet is not prepared to use commonly for iOS and Android in Xamarin.Forms. As you said, you have to use it separately (you have to install it separately in each platform). I'm going to take a look to the error that you found when you installed the package in Android platform. Which versions are you using?
Below is the error I am getting while trying to add liferay screens for android separately.
"All packages and projects are compatible with MonoAndroid,Version=v8.1."
And this is the error I am getting while adding liferay screens commonly for iOS and Android.
"Checking compatibility for Microsoft.NETCore.Platforms 1.1.0 with .NETStandard,Version=v2.0. Incompatible packages: 1 Package restore failed. Rolling back package changes for 'sampleLiferay'."
The versions I am using for Xamarin.Forms - 3.6 Android SDK -28
Thanks in advance.
Stuck with this issue. Please help us in solving this.
Hey @Moulikaattili we reproduced the issue and we realised that it was caused due to a version conflict. Sorry for the inconvenience. We will let you know when we have a solution.
@dgarciasarai Thank you for your support
@Moulikaattili I think I found a solution. First, check if at the beginning of your Package Console you see something like this:
NU1107: Version conflict detected for Xamarin.Android.Support.Annotations. Install/reference Xamarin.Android.Support.Annotations 27.0.2.1 directly to project demo_forms.Android to resolve this issue.
demo_forms.Android -> Xamarin.Android.Support.v7.MediaRouter 27.0.2.1 -> Xamarin.Android.Support.v7.Palette 27.0.2.1 -> Xamarin.Android.Support.Compat 27.0.2.1 -> Xamarin.Android.Support.Annotations (= 27.0.2.1)
demo_forms.Android -> LiferayScreens 1.0.0 -> Xamarin.Android.Support.Exif 25.3.1 -> Xamarin.Android.Support.Annotations (= 25.3.1).
If that happen, you should install first the higher version which is involved in the conflict. In this case it's Xamarin.Android.Support.Annotations (= 27.0.2.1)
. Then, you should add LiferayScreens NuGet package and the version conflict should be gone.
Let me know if it works as expected with this solution :)
Regards
@dgarciasarai a small question. Is it possible to integrate liferay screens (login) in Xamarin.Forms under .Net core? I tried it once but didn't happen so I chose shared option.
@Moulikaattili Sorry, but if I understand you, Liferay Screens NuGet was created to use it in each platform.
@dgarciasarai I got your point. My question is while creating the project, under shared code section if I select use shared library only then I am able to add liferay screens. But my main project is under use .Net Standard. So I want to make sure whether liferay works only with use shared library enabled. Attaching screenshot for your reference.
@dgarciasarai can you please help me in fixing this problem.
Did you try it?
Below is the code I Used in my project. A gray color screen was getting displayed but default login screenlet was not shown. when this piece of code was written "loginScreenlet.BasicAuthMethod = BasicAuthMethod.Email;" java null point exception was thrown. Please suggest me a solution for this.
var linearLayout = new LinearLayout(Context); linearLayout.LayoutParameters = new LayoutParams(600, 400); linearLayout.Orientation = Orientation.Vertical;