Hi everyone, I hope you all are happy as kodular has launched its new update. But a problem that many koders are facing this time is migration of extensions that they are using in their projects. Daily a lot of discussion or topic are published.
So after a long time I am publishing a complete guide about migration of the extensions that you uses in your projects.
So let’s start.
How to find
So our first step is obviously that we have to find the extension that needs migration to androidx library.
Note:- All extension don’t need to be migrated. Because all extension doesn’t use support library some are made without library. For ex, Dynamic Components extension .
Currently State Progress Bar hasn’t migrated to androidx that’s why if you use it then it can cause the error. Also, it will be soon fixed and will available to use but till we should not use that as it can cause error.
You must visit the Bug Tracker topic first and should know what the bug has already been reported to kodular so you don’t need to create more discussion about that.
So as you know how we can find that our project’s extensions need to be migrated. Obviously when we faces error of failed resolution
when we connect companion and uses apk.
So now how can you find that which extension needs migration. It is very simple to find that.
If you have a lot of extension then it quite difficult to find it but I have a easy way to find it. So how we can find?
I have made a test aia and imported three extensions it for example that are
- Phase
- Dynamic Component
- Recycler View
So we need to follow just these steps:-
- Create a new screen in your project(Keep it empty) .
- Connect the companion now to that screen.
- Then you have to drag the extensions in the screen.
- After dragging if all thing is normal then the extension that you have dragged doesn’t need migration but if after dragging it if you faced error of faild resolution then you need to migrate it.
Note:- Some extension does not throw error by only dragging them as they does not use anything on initialisation. So make sure to try them a little - Do the third step for all extensions one by one and list all those extensions that thrown the error.
Explaination with Images
As you can see I have imported three extensions
Now I am going to create a new screen and will connect to companion then.
After connecting to companion I will start to drag extension one by one
I have dragged the phase extension now and it has not thrown me error on initialisation So I will try it once for confirmation.
As you can see when I tried it then it thrown me a error it means it need to be migrated.
Lets drag now next one(Make sure to delete the previus dragged extension from the component list necesarry if throws error on screen initialisation).
Then I tried my recycler view extension
As you can see I faced the error on initialisation. BTW the error is not related to failed resoultion but this error comes when the extension uses some variables and method on initialisation and if it is coming without having any component on the screen then it mean that it need to be migrated.
Now I will drag Dynamic component extension
And I tried making component with it without facing any error it means it does not need any migration.
Now you first step has ended as you have got the extensions that are throwing errors. So now we will head to our second step.
Recast the Extensions
Now guys there is a simple thing that you will have to do with those extensions (that need to be migrated) is to migrate them yourself. But before migrating them you must visit the original topic of that extension because it may possible that the developers of those extensions already provided androidx version of the extension. If developer already provided those Extensions then you don’t need to migrate them. for ex, @Shreyash and me has already provided androidx version of the extension so you dont need to recast them. But I will show you recasting my extension so you can understand it completly.
So let’s start to migrate extensions.
Well there is a very simple way to migrate extensions with Recast.
Thanks to @Shreyash for introducing such easy way to do it.
Make sure you’re using latest version of Recast as there were some bug that are fixed in updates. So please don’t do anything by only reading top post of the topic.
So finally start now
You need to install Recast in your device first to use it. It is very easy to install it and the installation process is already posted by Shreyash So I am not going to explain it again as it is not such hard to install it.
Create a folder named anything and move the extensions(that need migration to that folder).For ex, C:\extensions
I have created a extension
named folder in disk C now you have to move you extension in this folder.
Like this,
Now click on the path and enter there cmd
and then hit enter. It will open your Command Prompt to that directory and then you have run a command to recast it. Like this
recast --input
then space and then your extension file name.
The whole command will be like this
recast --input com.sumit1334.customrecyclerview.support.aix
and then hit enter to run this command and you will see something like that.
If this shows complete then your extension migration is completed and the migrated extension will be at the same path the old extension was even the new one will be placed below the old one as you can see in this image.
Now you can import the new generated extension in your project and you will not face any error in your project.
If you faces any error now then just post here or in the topic of Recast instead og creating a new topic about this.
And must check the Bug Tracker so You cal already know about the bugs of kodular.
I hope this guide will be helpful for many koder that are facing this issue.
Good Bye to everyone
Sumit