Executing cross-compiled program in Android with Runtime.getRuntime()
<p>Android developer newbie here. I am trying to develop a GUI wrapper in Android for a small cross-compiled application that runs from the Android shell (using "adb shell"). The application performs some cryptographic operations and requires the gmp and libpaillier libraries. The application runs as expected when executed from the Android shell. However, when trying to execute it from the Android application layer (Android Activity) with the  Runtime.getRuntime().exec("cmd") object, I get the segmentation fault error showed below. It only happens when the cryptographic operations are used (for example, it works fine when just displaying the command line argument options). I will appreciate any advice that could help me to figure out this problem. Thanks. </p>

<pre><code>07-26 14:58:12.633: INFO/DEBUG(10175): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-26 14:58:12.633: INFO/DEBUG(10175): Build fingerprint: 'google/soju/crespo:2.3.4/GRJ22/121341:user/release-keys'
07-26 14:58:12.633: INFO/DEBUG(10175): pid: 12281, tid: 12281  &gt;&gt;&gt; /data/test/mptest &lt;&lt;&lt;
07-26 14:58:12.633: INFO/DEBUG(10175): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000c
07-26 14:58:12.633: INFO/DEBUG(10175):  r0 00000000  r1 00021180  r2 ffffff1c  r3 3fbae818
07-26 14:58:12.633: INFO/DEBUG(10175):  r4 afd41504  r5 bec40ad8  r6 80000000  r7 3fbae818
07-26 14:58:12.633: INFO/DEBUG(10175):  r8 00000000  r9 00000000  10 00000000  fp bec40c84
07-26 14:58:12.633: INFO/DEBUG(10175):  ip 00024188  sp bec40840  lr afd18821  pc afd1a894  cpsr a0000030
07-26 14:58:12.633: INFO/DEBUG(10175):  d0  afd46484afd46410  d1  6f427362b606cc00
07-26 14:58:12.633: INFO/DEBUG(10175):  d2  0000000000000000  d3  0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d4  0000000000000000  d5  0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d6  0000000000000000  d7  0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d8  0000000000000000  d9  0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d10 0000000000000000  d11 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d12 0000000000000000  d13 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d14 0000000000000000  d15 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d16 0000000000000000  d17 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d18 0000000000000000  d19 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d20 0000000000000000  d21 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d22 0000000000000000  d23 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d24 0000000000000000  d25 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d26 0000000000000000  d27 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d28 0000000000000000  d29 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  d30 0000000000000000  d31 0000000000000000
07-26 14:58:12.633: INFO/DEBUG(10175):  scr 00000000
07-26 14:58:12.645: INFO/DEBUG(10175):          #00  pc 0001a894  /system/lib/libc.so
07-26 14:58:12.649: INFO/DEBUG(10175):          #01  lr afd18821  /system/lib/libc.so
07-26 14:58:12.649: INFO/DEBUG(10175): code around pc:
07-26 14:58:12.649: INFO/DEBUG(10175): afd1a874 00000000 4ff0e92d 8b02ed2d f5ad4db5 
07-26 14:58:12.649: INFO/DEBUG(10175): afd1a884 46807d17 950f447d 9c0f4615 910e4ab2 
07-26 14:58:12.649: INFO/DEBUG(10175): afd1a894 300cf8b8 462c58a1 6808071a d5029095 
07-26 14:58:12.649: INFO/DEBUG(10175): afd1a8a4 3010f8d8 4640b963 ffb4f001 f7f7b140 
07-26 14:58:12.649: INFO/DEBUG(10175): afd1a8b4 2109fae7 f04f6001 900c30ff b9baf001 
07-26 14:58:12.649: INFO/DEBUG(10175): code around lr:
07-26 14:58:12.649: INFO/DEBUG(10175): afd18800 ffffff70 ffffff6c ffffff74 ffffff78 
07-26 14:58:12.649: INFO/DEBUG(10175): afd18810 b503b40e f852aa03 92011b04 f82cf002 
07-26 14:58:12.649: INFO/DEBUG(10175): afd18820 400ce8bd 4770b003 300cf9b0 4604b510 
07-26 14:58:12.649: INFO/DEBUG(10175): afd18830 f7f9b933 2109fb27 f04f6001 e01530ff 
07-26 14:58:12.649: INFO/DEBUG(10175): afd18840 68106b02 f104b140 45600c40 f7fbd001 
07-26 14:58:12.652: INFO/DEBUG(10175): stack:
07-26 14:58:12.652: INFO/DEBUG(10175):     bec40800  00000020  
07-26 14:58:12.652: INFO/DEBUG(10175):     bec40804  00024224  /data/test/mptest
07-26 14:58:12.652: INFO/DEBUG(10175):     bec40808  00000010  
07-26 14:58:12.652: INFO/DEBUG(10175):     bec4080c  00000020  
07-26 14:58:12.652: INFO/DEBUG(10175):     bec40810  00024224  /data/test/mptest
07-26 14:58:12.652: INFO/DEBUG(10175):     bec40814  00000010  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40818  00000010  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec4081c  b0009468  /system/bin/linker
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40820  ffffffff  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40824  00000000  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40828  6b6505b0  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec4082c  e69d3d64  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40830  cfcaab85  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40834  520fb67e  
07-26 14:58:12.656: INFO/DEBUG(10175):     bec40838  df002777  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec4083c  e3a070ad  
07-26 14:58:12.660: INFO/DEBUG(10175): #00 bec40840  69d2c15d  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec40844  77929325  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec40848  feb7d8da  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec4084c  686a93ac  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec40850  354e5ebd  
07-26 14:58:12.660: INFO/DEBUG(10175):     bec40854  84a276b3  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec40858  56777d01  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec4085c  43d437cf  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec40860  c678f383  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec40864  2d2f7b98  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec40868  45a2a873  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec4086c  d1230fb5  
07-26 14:58:12.664: INFO/DEBUG(10175):     bec40870  11ea3141  
07-26 14:58:12.668: INFO/DEBUG(10175):     bec40874  30b0ae58  
07-26 14:58:12.668: INFO/DEBUG(10175):     bec40878  00021180  /data/test/mptest
07-26 14:58:12.668: INFO/DEBUG(10175):     bec4087c  afd41504  /system/lib/libc.so
07-26 14:58:12.668: INFO/DEBUG(10175):     bec40880  000001c4  
07-26 14:58:12.668: INFO/DEBUG(10175):     bec40884  00000001  
07-26 14:58:15.652: DEBUG/dalvikvm(7064): GC_EXPLICIT freed 168K, 30% free 7359K/10439K, external 5458K/6546K, paused 87ms
07-26 14:58:21.613: DEBUG/dalvikvm(12270): Calling exit(1)
07-26 14:58:21.660: INFO/ActivityManager(106): Process com.android.emoc (pid 12270) has died.
07-26 14:58:21.664: INFO/WindowManager(106): WIN DEATH: Window{4058db50 com.android.emoc/com.android.emoc.EmocActivity paused=false}  
</code></pre>
