Restore keybaord

So I successfully built a Keyboard and then via android studio, released a successful app into the play store that a few native speakers are testing. After all this, my computer crashed and I lost the files. I need to make a few changes and am wondering how to add the right files to keyman developer to make the changes. Fortunately I emailed the .kmb file to a friend before I started working in android studio and here’s what I was able to extract from it:

  1. my .js file with the layout
  2. the .kmx file
  3. the welcome.htm file
  4. kmp.inf

I also have the .aab file from my developers console in the play store but have no idea how to open it. Here’s a link to the app: https://play.google.com/store/apps/details?id=com.keyman.kmsample2

Please help,
Daniel

From my research, the AAB (Android App Bundle) contains several APK files. This site explains how to extract the APK(s) files: https://stackoverflow.com/questions/53040047/generate-apk-file-from-aab-file-android-app-bundle . There are tools out there which try to decompile APKs (https://ibotpeaches.github.io/Apktool/), but they probably won’t get you something you can open in Android studio, and it’s probably not worth it.

Technically, all of the relevant keyboard details are encoded in the .js file, such as layout, rules, and css, but they’re pretty well obscured in JS logic and no longer in KM format. My suggestion would be to install the app on your phone, and rebuild it in KM Dev based on that model. For a Greek keyboard, I’m assuming that you don’t have very complex rules in the KMN, and also that you didn’t change kmsample2 very much.

One note, you accidentally published it to Google using the default “com.keyman.kmsample2”, so you will need to remove and republish it with our own custom/personal link since this is not an internal Keyman production.

This sort of data loss, and even much smaller ones, is a good argument for using such systems as Github for storing your code, doing versioning, and testing. There’s no way I could have gotten my Cameroon keyboard app to this level where it is without version-control.

The last thing you will need are your Android developer keystores and passwords, which I hope you still have somewhere. Since you’re going to have to delete and resubmit anyway, you could create a new keystore/password for the new app.

~Matthew

1 Like

Keyman Developer includes a kmdecomp tool that takes your .kmx keyboard to decompile a .kmn keyboard source file.

It’s typically located at C:\Program Files (x86)\keyman\Keyman Developer\kmdecomp.exe.

You’ll still need to recreate the .keyman-touch-layoutsource file.

1 Like

The .keyman-touch-layout source file can be extracted fairly easily from the .js file.

1 Like

Can you walk me through how?

Marc,

If you can walk me through the process I can look at writing a script to write the back conversion.

1 Like

A regex that may be adequate: this.KVKL=(.+?);this.

Alternatively, you’ll need to load the .js file into a text editor and look for the this.KVKL assignment. For example:

Finding the end of the touch layout is a little trickier because you’ve got to find the terminating ;. The easiest way may be to look for the next this keyword.

You need to select everything between the this.KVKL= and the terminating ;.

Note that if the keyboard was compiled with debug on, it will have additional whitespace and possibly comments and the regex I provided won’t be adequate.