Thursday, January 3, 2013

Android Terminal Emulator Crashes on cm-10.1 [Part 1]

After I installed the cm-10.1 on LGE p970 and tested it, it was pretty fast and smooth except for 2 things.

  1. Android Terminal Emulator (ATE) app crashes on launch.
  2. People app couldn't find vcard during import even though it exists on the root directory of the sdcard.
The ATE is a very important tool (at least for me).  I always use this during development and hacking.  I prefer  to work and debug things wirelessly.  So this article is about tweaking android and stuffs that I wanted them to behave.

The Cause.  Before I flashed cm-10.1, I remembered updating the ATE from Google Play.  During testing cm-10.1, the app crashes.  Finding the cause was easy.  First, I checked the stack trace.  Here's what the stack trace said.

Serioulsy?  This wasn't clear to me at all.  Second, I went to Google Play and found out that ATE is an open source project hosted at github.  From there, I browsed the issues before doing stupid things (i.e. asking solutions from developers or posting it in the issue tracker) and found this interesting issue (same as mine).

issue #133 Force close on start (UnsatisfiedLinkError)

It says,
I think if you install the apk into /system/app, the library loader needs the native library in /system/lib. (If you install to /data via the normal route, the package manager unpacks any native libraries in the package to /data/data/package.name/lib, and the library loader will look there also.)Basically, either extract libjackpal-androidterm4.so from the apk and install it to /system/lib, or install the package normally and let the package manager deal with this for you. This isn't a bug in ATE.
By reading this comment, everything is now clear.

So What Happened? By reading the first line of the stack trace,

java.lang.UnsatisfiedLinkError: Couldn't load jackpal-androidterm4 from loader dalvik.system.PathClassLoader[dexPath=/system/app/Term.apk,libraryPath=/data/data/jackpal-androidterm/lib]: findLibrary returned null

the system couldn't load a shared library in

jackpal-androidterm.so

in the library path,

libraryPath=/data/data/jackpal.androidterm/lib

this makes sense because after I update ATE, its path changed to /data/data/jackal.androidterm.  Since cm-10, ATE is preconfigured in the rom so path should be

libraryPath=/system/lib

as mentioned in the comment, extract jackpal-androidterm4.so from the apk and push it into /system/lib.  I haven't try this yet so I'll post it on the next series.

No comments:

Post a Comment