Recast • Make your old extensions compatible with Kodular Fenix

So, you were super excited about Kodular’s new release, waiting eagerly for all the new things. The update lands, you compile your app with all that excitement, install it, and poof! Your app is no longer working! All you see is a weird error that says, “Runtime Error Failed resolution of: ***”

Reading the posts on the community you might have realized that this happens because of some extensions that are not compatible with the new Kodular. But hey, you don’t have time to wait for each and every extension developer to update their extensions, right? So, what now?!? :fearful:

Introducing Recast :man_superhero:


Worry not, Recast is here for the rescue! With Recast, you can make your old extensions compatible with the latest version of Kodular all by yourself; no waiting for the extension developers to release a new update. :smirk_cat:

Recast is a command-line tool. Behind the scenes, it migrates all the references in your extensions from the old Android support libraries to their latest AndroidX equivalent. All of this happens without affecting the working of the extensions in any manner.

Enough talking, now, let’s see how you can use Recast to make your extensions compatible with the new Kodular.

Prerequisites


To use Recast, you need to have Java Runtime Environment (JRE) installed on your system. To check if you have it pre-installed, open your favorite terminal app and run the following:

java -version

If you get an output similar to below, JRE is already available on your system.

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

If you don’t see an output similar to the above, you will need to install Java before installing Recast.

Installing Recast [Latest version: 0.2.1]


Recast is a command-line tool, and therefore, you first need to install it on your computer to use it. As of now, Recast can be installed on the following operating systems:

  • Windows (64 bit)
  • macOS (x86_64 arch)
  • GNU/Linux (x86_64 arch)

Using PowerShell (Windows)

  1. Open PowerShell.
  2. Copy and paste the following and hit enter:
    iwr https://raw.githubusercontent.com/shreyashsaitwal/recast/main/scripts/install.ps1 -useb | iex
    
  3. Done! You’re all set up.

Using Shell (macOS and Linux)

  1. Open your favorite shell (terminal).

  2. Copy and paste the following and hit enter:

    curl https://raw.githubusercontent.com/shreyashsaitwal/recast/main/scripts/install.sh -fsSL | sh
    
  3. Once the download is complete, add Recast to your PATH by copying the export command from the output (as shown below) and running it:

  4. Done!

Usage


Recasting extensions (AIX)

To make your old extension compatible with Kodular >1.5.0 using Recast, go through the following steps:

  1. Navigate to the directory/folder where your extension is placed.
  2. Open your favorite terminal in that directory.
  3. Now, run the following:
    recast --input you.extension.aix
    
    (Here, your.extension.aix is the name of your extension)
  4. Bingo! A new, recasted extension with the name your.extension.x.aix is generated in the current working and ready to be used.

Recasting AIAs

Starting with Recast v0.2.0, you get the ability to recast your AIA files as well. This reduces the manual work of re-importing every recasted extension in your project.
Go through the following steps to recast your AIAs:

  1. Navigate to the directory/folder where your AIA is placed.
  2. Open your favorite terminal in that directory.
  3. Now, run the following:
    recast --input you_app.aia
    
    (Here, you_app.aia is the name of your AIA file)
  4. And there you go! All the extensions in your AIA are now recasted, and the new AIA can be found in the same directory with the name your_app_x.aia.

Note:
When you import a recasted AIA in Kodular (or AI2), your existing project isn’t affected. Instead, a separate project with the name your_app_x is created with all the existing work preserved.

Tips


  • You can recast multiple extensions all at once by gathering them all in one directory and then running:

    recast --input directory_path
    

    (Here, directory_path is the path to the directory where extensions are stored.)

  • If you want to output the recasted extension(s) in a separate directory, all you need to do is specify the --output option and pass the path to your desired directory.

    recast --input you.extension.aix --output output_dir_path
    

    (Here, output_dir_path is the path to the output directory.)

FAQ


  1. Do I need to recast every extension to make it compatible with Kodular >1.5.0?
    No, you don’t need to. Only the extensions that started throwing errors after the latest update need to be recasted.

  2. Why does Recast print No references to support libraries found when I try to recast my extension?
    It means that your extension is already compatible with Kodular >1.5.0, and you don’t need to recast it.

GitHub


Recast is open-source and is available on GitHub under the MIT license.

Feedback


Feel free to ask questions about almost anything related to Recast here. I understand most of you are no-coders and might not have used or installed a terminal app before. Every question is legit and no one’s gonna judge you.


Cheers,
Shreyash

63 Likes

Thank you! Instructions were very easy to follow.

However, I am having one issue. I am unable to replace the original aix files with the modified ones because they do “not contain any component definition files.”

Fixed!! Awesome job.

For those who have never used PowerShell for Windows, this is how you change your directory.

  1. Open File Explorer and go to the folder that contains your aix (extension) files
  2. Right-click the Address Bar and select “copy address”
  3. Open PowerShell (Looks like Command Prompt, but is blue)
  4. Type this → Set-Location -Path “{new folder directory}”
  5. Replace {new folder directory} with what you copied from File Explorer

Note: The quotes used with “{new folder directory}” are optional, but are required if you have any spaces, parenthesis or special characters in your folder names.

Source: https://www.itechguides.com/change-directory-in-powershell/

3 Likes

not working

Import Extension Failed!
Uploaded file does not contain any component definition files.

yeah same error is also showing to me

1 Like

But this recast method helped me to detect which extension need to be updated so until they respond for this issue i suggest to try alternative extensions

Still don’t working for me…

I’m investigating the issue that is causing the importing of the extension to fail. I will get back once I’ve something to share. Thanks for your patience.

8 Likes

I have only extension file, did I can correct it?

Extension works if we replace AndroidRuntime.jar & Classes.jar from new to old version.

1 Like

It works perfectly if you replace both files from new to old version and use old version.

Recast v0.1.1 HOTFIX


Changelog


  • Fixed the issue that prevented the recasted extensions from importing in the Creator.
    • Special thanks to @pavi2410 for helping me identify this bug.

Upgrading


To upgrade from v0.1.0 to v0.1.1, simply go through the installation steps mentioned in the first post:


Cheers,
Shreyash

5 Likes

Thanks a lot :folded_hands:

1 Like

After the update of Kodular the app started crashing, if I recast the extension used in the project will the app crash or not?

If you see words like “Failed resolution of… android support”, then you must Recast the extensions used one by one. We are looking into ways to improve this situation.

4 Likes

You can recast them all at once as well. :wink:

3 Likes

hello, how can i add a path in Powershell of windows where the extension is given to convert it to the version that works in kodular. Thank-you

1 Like

Thanks for this guide. I have listPermission extension in my project. My app was crashing. I was able to fix with recast.
It works!
Thanks

2 Likes