[Android Q&A, Help & Troubleshooting] xLyte:
Hi,

I am currently trying to build TaintDroid 4.3 for x86 emulators. Since I am new to building Android, I thought this would be a good place to get help/information.

So, I built Android 4.3_r1 and Android 4.3_r1 with TaintDroid successfully for ARM. These are the steps I did to build it for x86:

- Download goldfish 2.6.29 and a patch from appanalysis to add xattr support for yaffs: appanalysis.org/files/yaffs_xattr.patch

- After patching the kernel I built it successfully

- I built the TaintDroid source as followed:

. build/envsetup.sh
lunch aosp_x86-eng
make clean
make -j4

- The build finishes without any errors

- I created an AVD like this: android create avd -n test -t 1 --abi default/x86

- Eventually I started the emulator like this: sudo emulator -kernel MYKERNEL -system MYSYSTEM.IMG -data MYUSERDATA.img -ramdisk MYRAMDISK.img -avd test -verbose

Unfortunately the emulator doesn't boot properly and only shows me the android animation, even after setting the execution mode to portable.

So I looked into logcat and got the following:

D/AndroidRuntime( 3081): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 3081): CheckJNI is ON
E/dalvikvm( 3081): Bad asm offset offThread_jitToInterpEntries (108), should be 104
E/dalvikvm( 3081): Bad asm offset offThread_inJitCodeCache (132), should be 128
E/dalvikvm( 3081): Bad asm offset offThread_pJitProfTable (136), should be 132
E/dalvikvm( 3081): Bad asm offset offThread_jitThreshold (140), should be 136
E/dalvikvm( 3081): Bad asm offset offThread_jitResumeNPC (144), should be 140
E/dalvikvm( 3081): Bad asm offset offThread_jitResumeNSP (148), should be 144
E/dalvikvm( 3081): Bad asm offset offThread_jitResumeDPC (152), should be 148
E/dalvikvm( 3081): Bad asm offset offThread_jitState (156), should be 152
E/dalvikvm( 3081): Bad asm offset offThread_icRechainCount (160), should be 156
E/dalvikvm( 3081): Bad asm offset offThread_pProfileCountdown (164), should be 160
E/dalvikvm( 3081): Bad asm offset offThread_callsiteClass (168), should be 164
E/dalvikvm( 3081): Bad asm offset offThread_methodToCall (172), should be 168
E/dalvikvm( 3081): Bad asm offset offThread_jniLocal_topCookie (176), should be 172
E/dalvikvm( 3081): Please correct the values in mterp/common/asm-constants.h
E/dalvikvm( 3081): VM aborting

After fixing the values and rebuilding the source code I still can't run the emulator and get the following messages through logcat:

D/AndroidRuntime( 3974): >>>>>> AndroidRuntime START com.android.internal.os.ZygoteInit <<<<<<
D/AndroidRuntime( 3974): CheckJNI is ON
D/dalvikvm( 3974): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 3974): Added shared lib libjavacore.so 0x0
D/dalvikvm( 3974): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 3974): Added shared lib libnativehelper.so 0x0
W/dalvikvm( 3974): Exception Ljava/lang/NullPointerException; thrown while initializing Ljava/lang/ThreadGroup;
E/dalvikvm( 3974): thread classes failed to initialize
W/dalvikvm( 3974): CreateJavaVM failed: dvmPrepMainThread failed
E/AndroidRuntime( 3974): JNI_CreateJavaVM failed
I/ServiceManager( 787): service 'media.audio_flinger' died
I/ServiceManager( 787): service 'media.player' died
I/ServiceManager( 787): service 'media.camera' died
I/ServiceManager( 787): service 'media.audio_policy' died
I/mediaserver( 3975): ServiceManager: 0xb9c51b30
I/AudioFlinger( 3975): Using default 3000 mSec as standby time.
I/CameraService( 3975): CameraService started (pid=3975)
I/Netd ( 3976): Netd 1.0 starting
W/InterfaceController( 3976): Warning (dlopen failed: library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library

I also tried to use goldfish 3.4, but the error message about libnetcmdiface.so and the NullPointerException while initializing Ljava/lang/ThreadGroup still remains and I don't really know what that lib does and why it's missing. I think the media services are dying because of that though.

I know this is not a TaintDroid board, but I don't think this issue is only related to TaintDroid and could happen to any Android source, which was modified or ported to x86.

To use TaintDroid properly I need a kernel with xattr support for yaffs. This is why I patched the kernel and why I also tried goldfish 3.4.

I appreciate any help you can give me.

xLyte