Need help porting android on top of ubuntu to run android apps

60 views
Skip to first unread message

Mohammad Merajul Islam Molla

unread,
Sep 24, 2014, 11:04:48 AM9/24/14
to android...@googlegroups.com
Hello,

I am trying to port android on top of ubuntu (x86) so that I can run
android APKs on top of ubuntu. Here is what I have so far.

I built linux kernel 3.14.4 with all android related options -

#
# Android
#
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ASHMEM=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_TIMED_OUTPUT=y
CONFIG_ANDROID_TIMED_GPIO=y
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
CONFIG_ANDROID_INTF_ALARM_DEV=y
CONFIG_SYNC=y
CONFIG_SW_SYNC=y
CONFIG_SW_SYNC_USER=y
CONFIG_ION=y

I built AOSP android for x86 and copied the contents of /system folder
on my machine's /system directory (I created this directory). I was
able to run simple Java program using dalvikvm.

/system/bin$ ./dalvikvm -cp ~/HelloWorld.zip HelloWorld
WARNING: linker: libdvm.so has text relocations. This is wasting
memory and is a security risk. Please fix.
Hello World!

But whenever I try to run any android app I am having problem. I tried
to run the Browser App using am command as follows -

/system/bin$ ./am start -a android.intent.action.MAIN -n
com.android.browser/.BrowserActivity
Aborted (core dumped)

It crashes the program. I have collected strace output of this command
with (which is attached) -

/system/bin$ strace -s 1024 ./am start -a android.intent.action.MAIN
-n com.android.browser/.BrowserActivity > /tmp/am 2>&1
Aborted (core dumped)

No matter what app I run, I get the same "Aborted (core dumped)".

From strace output -

writev(10, [{"\5", 1}, {"dalvikvm\0", 9}, {"Unable to resolve
superclass of Lcom/android/commands/am/Am; (42)\0", 66}], 3) = 76
writev(10, [{"\5", 1}, {"dalvikvm\0", 9}, {"Link of class
'Lcom/android/commands/am/Am;' failed\0", 52}], 3) = 62
mprotect(0xb1d26000, 4096, PROT_READ|PROT_WRITE) = 0
writev(10, [{"\6", 1}, {"appproc\0", 8}, {"ERROR: could not find class
'com.android.commands.am.Am'\n\0", 58}], 3) = 67
writev(10, [{"\5", 1}, {"dalvikvm\0", 9}, {"JNI WARNING: JNI function
NewGlobalRef called with exception pending\0", 69}], 3) = 79
writev(10, [{"\5", 1}, {"dalvikvm\0", 9}, {"             in
Ldalvik/system/NativeStart;.main:([Ljava/lang/String;)V
(NewGlobalRef)\0", 87}], 3) = 97
writev(10, [{"\5", 1}, {"dalvikvm\0", 9}, {"Pending exception is:\0",
22}], 3) = 32
writev(10, [{"\4", 1}, {"dalvikvm\0", 9},
{"java.lang.NoClassDefFoundError: com/android/commands/am/Am\0", 59}],
3) = 69
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"\tat
dalvik.system.NativeStart.main(Native Method)\0", 50}], 3) = 60
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"Caused by:\0", 11}], 3) = 21
writev(10, [{"\4", 1}, {"dalvikvm\0", 9},
{"java.lang.ClassNotFoundException: Didn't find class
\"com.android.commands.am.Am\" on path: DexPathList[[zip file
\"/system/framework/am.jar\"],nativeLibraryDirectories=[/system/lib]]\0",
180}], 3) = 190
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"\tat
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)\0",
75}], 3) = 85
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"\tat
java.lang.ClassLoader.loadClass(ClassLoader.java:497)\0", 58}], 3) =
68
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"\tat
java.lang.ClassLoader.loadClass(ClassLoader.java:457)\0", 58}], 3) =
68
writev(10, [{"\4", 1}, {"dalvikvm\0", 9}, {"\tat
dalvik.system.NativeStart.main(Native Method)\0", 50}], 3) = 60


It looks like the command can't find com.android.commands.am.Am class
whereas I have am.jar in /system/framework/ which should provide it.

various environment variables are setup as follows -

export ANDROID_ROOT=/system
bootpath=/system/framework
export BOOTCLASSPATH=$bootpath/core.jar:$bootpath/ext.jar:$bootpath/framework.jar:$bootpath/android.policy.jar:$bootpath/services.jar
export ANDROID_DATA=/tmp

Could someone please help? I can't seem to figure out what is wrong.


--
Thanks,
-Meraj
am.txt
Reply all
Reply to author
Forward
0 new messages