How to Recast Extensions to Support AndroidX Libraries

Sharing Is Caring:

Recently Kodular updated its version and named the new version Kodular Fenix. Many old extensions are not working on Kodular Fenix and showing java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat; error while live testing the app through the Kodular Companion and use the app after exporting it. To solve this error we have to recast the old extensions that we are using in our projects. Many extensions like the Dynamic Extension for every component does not require to be recast as the extension support AndroidX libraries. So in this post, we are going to share the steps to recast an extension to make it compatible with Kodular Fenix.

Recast Extensions to Support AndroidX Libraries
Recast Extensions to Support AndroidX Libraries

Recast Extensions to Supports AndroidX Libraries

In order to recast the extensions, you need to have Java Runtime Environment (JRE) and Java JDK installed on your system. If you want to check whether it’s already installed on your system or not then open the CMD app. and then write the below code and hit enter.

java -version

after you hit the enter button you will get results something like below

java version “1.8.0_281”

Java(TM) SE Runtime Environment (build 1.8.0_281-b09)

If you got results something like above then Java JDK and Java Runtime Environment are already installed on your system and you have to download only the Recast. If you didn’t get results like above then you have to install all these things. Just follow the below-given steps to install all and recast your extension.

Install Java JDK and Add it to Path

To install Java JDK download it from here and click on JDK Download. After clicking on JDK Download choose your system configuration and download the installation file. After download complete click on the file to install it. After installation is done copy the file path where the file is installed.

In our case, the file path is C:\Program Files\Java\jdk-16.0.2\bin. After the installation is done and you got the file path now we have to add the path in the environment. follow the steps given below.

Goto: Control Panel> System and Security > System > Advanced System Settings from left menu > Environment Variables >Under System Variables select Path and Click EDIT> And then select NEW > Add the file path where your Java JDK is located and Select OK.

If you are confused with the steps then watch the video given below.

Install Java Runtime Environment and Add it to Path

After Java JDK is completely installed and added to the Environment Path, we have to install Java Runtime Environment and also have to add it to the Environment Path. Download first Java Runtime Environment from here. After downloading it install it to your system and copy the file path. In our case, the file path is C:\Program Files\Java\jre1.8.0_301\bin. After you completely install it to your system and copy the file path we have to add it is also to Environment Path.

Goto: Control Panel> System and Security > System > Advanced System Settings from left menu > Environment Variables >Under System Variables select Path and Click EDIT> And then select NEW > Add the file path where your Java JDK is located and Select OK. here to add the Environment Variable Path.

Watch the below video to get more clarification.

Install Recast and Recast Extensions

After you install Java JDK and Java JRE and added you both to the Path you are ready to Install Recast. To install Recast open Windows Power Shell for your Windows System and enter the code given below.

iwr https://raw.githubusercontent.com/shreyashsaitwal/recast/main/scripts/install.ps1 -useb | iex

You have a macOS system then open your shell(terminal) app and paste and hit the below code.

curl https://raw.githubusercontent.com/shreyashsaitwal/recast/main/scripts/install.sh -fsSL | sh

if hitting enter you get a message like this Success! Installed recast at file path then you have successfully installed the recast to your system. Now you only have to recast the extensions you need. To recast the extensions make a folder in Desktop and name it anything you want. We name it Extensions and add all the extensions to this folder.

Now if you have a Windows PC then open Windows Power Shell Application and if you have Mac PC the open the shell (terminal) application of your system.

  • Copy the extension path: Copy the path of the extension you want to recast. The file path of our application is C:\Users\ User Name\Desktop\Extensions\com.devyb.devybimageloader.aix but we will one use \Desktop\Extensions\com.devyb.devybimageloader.aix this file path. Just copy the path of your extension like me.
  • Open the Windows Power Shell App for Windows and Any Shell or Terminal App you have in your system.
  • type recast –input file location. Like recast –input \Desktop\Extensions\com.devyb.devybimageloader.aix and hit enter. After this it will take a moment to process this.
  • After processing if you see messege like Complete Generated and then your extension name with x.aix at the end means your extension is successfully installed. And if you see messege like No references to support libraries found that means the extension you want to recast is already supporting AndroidX Librariries and doesnot required to be recacst to use with Kodular Fenix.
  • You will get your recasted extension at C:\Users\User Name location. The recast extension has x.aix extension at the instead of aix.

Conclusion

Now you are ready to use your old extensions with Kodular Fenix as they are supporting now AndroidX Libraries. Some of DeepHost’s extensions are not working perfectly after recast them and using them with Kodular. It will be better if you use some alternatives of DeepHost’s extension as he does not provide any response to the queries related to this or has a very less response rate. You will find all the extensions at the index of all available extensions.

1 thought on “How to Recast Extensions to Support AndroidX Libraries”

Leave a Comment