uber / nanoscope

An extremely accurate Android method tracing tool.
Apache License 2.0
1.25k stars 68 forks source link

Emulator Build #53

Closed Leland-Takamine closed 6 years ago

Leland-Takamine commented 6 years ago

Distribute build for emulator. Possibly allow launching with nanoscope command-line tool.

We'll probably want an x86 emulator to make use of HAXM. This means we'll need to add support into the x86 compiler and update some ARM-specific code in the interpreter.

Original comment on Reddit:

It would be awesome if you guys could package up an emulator image with it already installed. I really want to use this, but I can't justify going down the rabbit hole of building a custom os then figuring out how to put it on an emulator, all to use a third party tool that may or many not actually solve any of our problems. Not to knock any of the work you guys are doing, this is awesome stuff, but the entry complexity is still very high if you don't happen to have an extra N6P lying around.

kageiit commented 6 years ago

Bonus points if we can setup a docker image with nanoscope and emulator as part of it so anyone can just boot it up to give it a try

Leland-Takamine commented 6 years ago

Quick update: Added support for Nanoscope to x86 builds. Locally, I'm able to launch an emulator with Nanoscope support. Next, we need to figure out how to package up the emulator so that others can use it. I've been looking around for standard ways of doing this for the past couple days. If anyone has any idea how to do this, please let me know.

Leland-Takamine commented 6 years ago

Support for this has landed. Brew upgrade your nanoscope command and run the following to launch the Nanoscope Emulator:

$ nanoscope emulator
fdoyle commented 6 years ago

Gave it a try, emulator loads up great.

It's not in the instructions, so I figured I'd mention: If your android_home isn't set, it starts looking for SDK stuff in your root directory, and failing because it's not there. Took a moment to figure out what that was about, so it might be worth adding something about that to the readme or as an error.

Anyway, I'm actually the guy in that comment, wanted to say thanks for making this happen. Really awesome stuff!

Leland-Takamine commented 6 years ago

Glad that worked for you @fdoyle and thanks for suggesting the improvement! I updated the README to mention ANDROID_HOME as a prerequisite. In a future release, we'll update the emulator launch script to check for ANDROID_HOME.

56

AndrejLee commented 6 years ago

It keeps throwing "Failed to download zip: Connection reset" while downloading rom for emulator. Does anyone know the solution to this issue?

Downloading to /home/cpu10152-local/.nanoscope/roms/c1sEHfsSLhstgkhc6EcnQQ==...
Downloading: cache.img...
Downloading: config.ini...
Downloading: emulator.sh...
Downloading: ramdisk.img...
Failed to download zip: Connection reset
Leland-Takamine commented 6 years ago

@AndrejLee It's failing while trying to download and unzip the emulator zip file. It's a single HTTP connection for all of these files and it looks like it successfully downloads and unzips part of the archive. My guess is that this is due to poor network conditions.

AndrejLee commented 6 years ago

@Leland-Takamine thank you for your answer. Now i get this problem when running the emulator, it shows up and disappears immediately and throws this error: ./emulator.sh: line 22: 2628 Segmentation fault (core dumped) $ANDROID_HOME/emulator/emulator64-x86 -verbose -sysdir $WORK_DIR -system $WORK_DIR/system.img -ramdisk $WORK_DIR/ramdisk.img -data $WORK_DIR/userdata.img -kernel $KERNEL_FILE -memory 1024 -partition-size 2056 -gpu host -skindir $ANDROID_HOME/skins -skin pixel

Leland-Takamine commented 6 years ago

For now, the emulator only works on macOS. What operating system are you using?

AndrejLee commented 6 years ago

@Leland-Takamine 😆 I tried to launch it on Linux, I guess I will take a break till the next update 😆