Richard
Richard

Reputation: 157

How to build android UIAutomator project?

Is there any way how to build UiAutomator (https://android.googlesource.com/platform/frameworks/testing/+/jb-mr2-release/uiautomator/cmds/uiautomator/) module? UiAutomator has command called dump, which you can execute on device / emulator shell by calling uiautomator dump and this will generate a xml file with UI hierarchy. But what a problem is that if special character came into play (visible on screen) likey smileys which Im guessing are UTF-16 chars the xml generator behind the UIAutomator fails (this is actually known issue) with exception of IllegalCharacter

https://android.googlesource.com/platform/libcore/+/10d1f630d8df0064ed966193fa8c9d10a96a8321/xml/src/main/java/org/kxml2/io/KXmlSerializer.java line 130

Im not really experienced in java programming, but I'm guessing I should be able to update java code to avoid this issue. But the problem is Im not really able to compile this module into jar file.

Can anyone help me with this?

Upvotes: 3

Views: 984

Answers (1)

Renaud Mathieu
Renaud Mathieu

Reputation: 376

Yes it's possible you just have to checkout AOSP project and build this particular module. Here is how:

  1. Set up your environment (I hope you are using an UNIX based computer)
  2. Download AOSP source
  3. Build AOSP

Now, the trick is to build UiAutomator as a Framework (AOSP) module. To do so, run:

make uiautomator

Be sure you set up your environment variable (source build/envsetup.sh) and select your target and combo (lunch) beforehand.

NB: each AOSP module contains an Android.mk makefile where the module name is specified. In your example, I just look at the Android.mk and found this out :

LOCAL_MODULE := uiautomator

Upvotes: 4

Related Questions