AI2 generates APKs
August 11, 2015 —
BarryK
A quick progress report on App Inventor 2. Here is the previous post:
http://bkhome.org/news/201507/app-inventor2-compiled.html
As I earlier reported, I have got AI2 running locally, so it can work offline.
It worked, and I was able to attach my phone via USB cable and test apps that I had created.
However, I could not get AI2 to generate .apk files, which is the Android package format, so I went on to other things for awhile.
Now I have tackled it again, and now generation of .apk files is working.
What is not yet working is the emulator. Which personally I don't need, as I have a selection of Android phones.
But, I will study this topic a bit more, and see if I can get it to work.
Comments
Some notes re trying to get the emulator to work...To connect a phone via USB or to run the phone emulator, requires package 'appinventor2-setup_1.1.tar.gz', as explained here:
http://appinventor.mit.edu/explore/ai2/linux.html
Fine, the USB connection works, however AI2 starts the emulator but then reports that it is "too old" -- which I take to mean that the "companion app" installed in the emulator is too old.
The "companion app" is an app that you install on your phone when using the phone via USB, and it is also required to be installed in the emulator if AI2 is to run its apps on the emulator.
The Mac and Windows 'appinventor2-setup' packages are up-to-date, and from reading it seems that they also offer to download the latest companion-app if required -- the Linux appinventor2-setup does not do that.
So, I have been looking at updating the companion app manually.
appinventor2-setup is installed at /usr/google/appinventor, with the tools in folder 'commands-for-Appinventor'.
Opening a terminal in this folder, I did this:
I copied 'MIT AI2 Companion.apk' that I had compiled in the appinventor source package, into this folder. Then ran:
# ./run-emulator
# emulator: WARNING: data partition size adjusted to match image file (85 MB > 84 MB)
emulator: ERROR: Could not load OpenGLES emulation library: libOpenglRender.so: cannot open shared object file: No such file or directory
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
<
Then I opened another terminal in the same folder and ran:
# ./adb install -r "MIT AI2 Companion.apk"
./adb: /usr/lib/libcrypto.so.1.0.0: no version information available (required by ./adb)
1579 KB/s (2797978 bytes in 1.730s)
pkg: /data/local/tmp/MIT AI2 Companion.apk
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
<
...so, that is the current status, I am wondering why it is failing.
I can't see how to use any of the utilities, such as 'adb', to list the apps already installed in the emulator -- that would be good to do.
And I have no idea what INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES means, nor how to get around it.
That 'run-emulator' is a daemon, that brings up a window with a phone in it. Note, very old version of Android, API8, don't know what versions of Android that corresponds to.
Anyway, in the window I am able to navigate around, just like using a phone, except I am doing it with the keyboard and mouse, and in "Dev Tools -> Package Browser" I was able to find the exact name of the installed companion app, which is "edu.mit.appinventor.aicompanion3". It ilaso shows the version: 2.11
Hence, I was able to uninstall it:
# ./adb uninstall edu.mit.appinventor.aicompanion3
./adb: /usr/lib/libcrypto.so.1.0.0: no version information available (required by ./adb)
Success
<
Now:
# ./adb install -r "MIT AI2 Companion.apk"
./adb: /usr/lib/libcrypto.so.1.0.0: no version information available (required by ./adb)
2020 KB/s (2797978 bytes in 1.352s)
pkg: /data/local/tmp/MIT AI2 Companion.apk
Success
<
looking in the emulator window, I see that the new app has the same name "edu.mit.appinventor.aicompanion3", and is now version 2.27. Great!
Next step is to find out if this works with AI2!
Perhaps I should kill the emulator now, before starting AI2:
# killall emulator-arm
<
Tags: linux