Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Default login screenlet issue #74

Open
Moulikaattili opened this issue Mar 22, 2019 · 18 comments
Open

Default login screenlet issue #74

Moulikaattili opened this issue Mar 22, 2019 · 18 comments

Comments

@Moulikaattili
Copy link

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;

            LoginScreenlet loginScreenlet = new LoginScreenlet(Context);
            //loginScreenlet.BasicAuthMethod = BasicAuthMethod.Email;
            linearLayout.SetBackgroundColor(Android.Graphics.Color.Gray);

            loginScreenlet.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
            loginScreenlet.Listener = this;

            linearLayout.AddView(loginScreenlet);

            this.SetNativeControl(linearLayout);
@javiergamarra
Copy link
Contributor

Are you using the screenlet with Xamarin or native Android?

@Moulikaattili
Copy link
Author

Using it with Xamarin

@javiergamarra
Copy link
Contributor

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?

@Moulikaattili
Copy link
Author

I am already using it, but it didn't work.

@javiergamarra
Copy link
Contributor

Can you use the screenlet that way? by referencing it from a resource file instead of instantiating it?

@Moulikaattili
Copy link
Author

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'."

@javiergamarra
Copy link
Contributor

javiergamarra commented Mar 26, 2019

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();
        }

@dgarciasarai
Copy link
Contributor

@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?

@Moulikaattili
Copy link
Author

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.

@Moulikaattili
Copy link
Author

Stuck with this issue. Please help us in solving this.

@dgarciasarai
Copy link
Contributor

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.

@Moulikaattili
Copy link
Author

@dgarciasarai Thank you for your support

@dgarciasarai
Copy link
Contributor

@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

@Moulikaattili
Copy link
Author

@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.

@dgarciasarai
Copy link
Contributor

@Moulikaattili Sorry, but if I understand you, Liferay Screens NuGet was created to use it in each platform.

@Moulikaattili
Copy link
Author

@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.

Screen Shot 2019-04-05 at 2 13 16 PM

@Moulikaattili
Copy link
Author

@dgarciasarai can you please help me in fixing this problem.

@javiergamarra
Copy link
Contributor

Did you try it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants