Gorilla-Player-Support
Gorilla-Player-Support copied to clipboard
Custom Renderers Not working
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:
The RoundedRenderer.cs file in the Android solution references and exports the Renderer in the shared solution:
I then register the assemblies (classes) in the MainActivity.cs file in Android:
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:
And yet the Gorilla SDK is installed. Please could you assist?
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
.
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>()
));
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.
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.
@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
?
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.
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 '
hmm, I replied to en email chain and my reply got posted here. The issues are unrelated though. I'll delete my posts.
@Robson02, did you try to just load the master branch of my repo and run it "as is"?
No I did not try that. I will download and give it a go.
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 '
But your project has no Android solution and I am trying to view this is an Android emulator (working in Windows).
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.