Gorilla-Player-Support icon indicating copy to clipboard operation
Gorilla-Player-Support copied to clipboard

Custom Renderers Not working

Open basharat58 opened this issue 6 years ago • 12 comments

I am using Gorilla player to view a page with some some Custom Renderers. It gives an error: Gorilla SDK needed The previewed page requires assemblies not available in this player. Please use the Gorilla SDK to include those and get an optimal preview.

I have followed the process outlined here: https://github.com/UXDivers/Gorilla-Player-Support/wiki/Gorilla-SDK. My Android solutions have reference to UXDivers.Gorilla.SDK and UXDivers.Gorilla.SDK.Droid which I installed using Nuget.

Below is a picture of my Shared and Android solution, showing the Custom Renderers that I am looking to integrate: solution

The RoundedRenderer.cs file in the Android solution references and exports the Renderer in the shared solution: android-custom

I then register the assemblies (classes) in the MainActivity.cs file in Android: load-application

However when I run the file using Gorilla player (everything is set up fine as I can view other pages in Gorilla Player including a page that has a Listview with data loaded from the DesignTimeData.json file) I get the following: player

And yet the Gorilla SDK is installed. Please could you assist?

basharat58 avatar Mar 28 '18 15:03 basharat58

Your two screenshots are inconsistent. Did you rename you renderers? On screenshot 1 it's called RoundedRenderer and on screenshot 2 you register from type Rounded.

FrancoisM avatar Apr 05 '18 07:04 FrancoisM

Hi FrancoisM,

Those are the names above. In the standard project, the files are called: Rounded and NavigationBar. In the platform specific/native projects the files are called: RoundedRenderer and NavigationBarRenderer.

I thought that in the MainActivity.cs file I had to to register Rounded and NavigationBar for the RegisterAssemblyFromType - I was not sure what exactly I had to register (just started to use Gorilla player). I changed it to the following, but it is still not working:

LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication(this, new UXDivers.Gorilla.Config("Good Gorilla") .RegisterAssemblyFromType<CustomRenderers.Buttons.RoundedRenderer>()
.RegisterAssemblyFromType<CustomRenderers.Navigation.NavigationBarRenderer>() ));

basharat58 avatar Apr 05 '18 18:04 basharat58

check my repo as a starting point with Gorilla and custom renderers.

Note that you don't register types but assemblies. So as I guess your custom renderers are in the same assembly, then you registered it twice. Moreover, if your custom renderers are in the android app itself (i.e you didn't use a separate android library for your renderers) then I don't think you need to register any assemblies.

FrancoisM avatar Apr 05 '18 18:04 FrancoisM

I looked at your repo, but could not make any progress going off that and then comparing that to my solution. Really don't know what the issue can be.

basharat58 avatar Apr 06 '18 20:04 basharat58

@FrancoisM Gorilla should not have any issue finding those converters. Are the assemblies where those converters resides registered with the SDK? How are those converters declared in the App.xaml?

LeoHere avatar Apr 24 '18 17:04 LeoHere

Hi FrancoisM,

Sorry, I don't know the answer to your question. I am still stuck with my initial problem above. The Gorilla player on my android emulator stopped working and I uninstalled it.

When I go to the Play Store it says that it is installed so does not let me install again.

basharat58 avatar Apr 29 '18 15:04 basharat58

FrancoisM/LeoHere

Can you help?. I am just stumped, and get the following warning:

{"level":"warn","message":"Unable to resolve type 'null.Rounded' with arguments '' and assembly '<UNDEFINED>'.","timestamp":"2018-05-01T17:29:54.354Z"} {"processingIssue":true,"issueType":"warning","position":{"file":"E:\Development\Xamarin\Grial\EcomApp1\EcomApp1\EcomApp1\Views\MainView.xaml","hasPosition":true,"line":81,"column":44,"position":3293},"area":"Xaml","scope":"Req","contextInstanceId":33,"targetId":28,"sampleDataId":1,"level":"info","message":"Xaml processing warning Summary:"Tag custombutton:Rounded was removed"; Message:"Tag custombutton:Rounded removed because is defined in a assembly outside Players known assemblies. Extend the player through the SDK to solve this."","timestamp":"2018-05-01T17:29:54.354Z"}****

basharat58 avatar May 01 '18 17:05 basharat58

hmm, I replied to en email chain and my reply got posted here. The issues are unrelated though. I'll delete my posts.

FrancoisM avatar May 01 '18 19:05 FrancoisM

@Robson02, did you try to just load the master branch of my repo and run it "as is"?

FrancoisM avatar May 01 '18 19:05 FrancoisM

No I did not try that. I will download and give it a go.

basharat58 avatar May 01 '18 21:05 basharat58

Hi FrancoisM

I downloaded your repo and tried to run that in Gorilla. On the MainPage.xaml file where we have:

<ctrl:RoundedBoxView Color="#ff0000" CornerRadius="100" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,200,200" />

it is giving me the same issue as I am having in my own project: Unable to resolve type 'Controls.RoundedBoxView' with arguments '' and assembly '<UNDEFINED>'.

But your project has no Android solution and I am trying to view this is an Android emulator (working in Windows).

basharat58 avatar May 05 '18 07:05 basharat58

How could you "run that in Gorilla" in the first place as my repo only has an iOS project and you're on windows? I start to sense that the problem comes down to the way you use gorilla. Don't use Gorilla Player. Just run the app (mine, yours, whatever) which has the SDK Player embedded into it.

FrancoisM avatar May 08 '18 07:05 FrancoisM