Porting Win(WinCE) App to android How to debug it? lazarus / 43-Android ---------------------------------------------------------------------- roeug · 2012-10-25 07:12 I an in porting Win(WinCE) App to android Host OS Windows Compiled Made apk Installed to Emulator In execution I have "unfortunately has stopped [OK]" 1. How to debug it? 2. How to add binary file to be used in my application? ---------------------------------------------------------------------- roeug · 2012-10-26 06:38 Ok First errors (by Dalvik Debug Monitor) 10-26 07:34:26.414: I/ActivityManager(83): Start proc com.FIFTYmegs.roeug for activity com.FIFTYmegs.roeug/.LCLActivity: pid=20897 uid=10033 gids={1015} 10-26 07:34:26.634: I/dalvikvm(20897): Turning on JNI app bug workarounds for target SDK version 8... 10-26 07:34:26.704: W/NetworkManagementSocketTagger(83): setKernelCountSet(10033, 1) failed with errno -2 10-26 07:34:27.014: I/lclapp(20897): Trying to load liblclapp.so 10-26 07:34:27.054: E/lclapp(20897): WARNING: Could not load liblclapp.so 10-26 07:34:27.054: W/System.err(20897): java.lang.UnsatisfiedLinkError: Couldn't load lclapp: findLibrary returned null 10-26 07:34:27.374: W/dalvikvm(20897): No implementation found for native Lcom/FIFTYmegs/roeug/LCLActivity;.LCLOnCreate (Lcom/FIFTYmegs/roeug/LCLActivity;)I 10-26 07:34:27.374: D/AndroidRuntime(20897): Shutting down VM 10-26 07:34:27.374: W/dalvikvm(20897): threadid=1: thread exiting with uncaught exception (group=0x40a381f8) 10-26 07:34:27.384: I/DEBUG(20910): Received buf=[5]20897 ... 10-26 07:34:27.214: I/Process(83): Sending signal. PID: 20897 SIG: 3 10-26 07:34:27.214: I/dalvikvm(20897): threadid=3: reacting to signal 3 10-26 07:34:27.344: I/dalvikvm(20897): Wrote stack traces to '/data/anr/traces.txt' 10-26 07:34:27.344: D/ActivityManager(83): Request the debuggerd to dump stack for PID:20897 10-26 07:34:27.374: D/ActivityManager(83): ANR trace path=/data/anr/traces.txt_13.txt 10-26 07:34:27.374: I/DEBUG(20910): Enter handle_dump_request 10-26 07:34:27.374: W/dalvikvm(20897): No implementation found for native Lcom/FIFTYmegs/roeug/LCLActivity;.LCLOnCreate (Lcom/FIFTYmegs/roeug/LCLActivity;)I 10-26 07:34:27.374: D/AndroidRuntime(20897): Shutting down VM 10-26 07:34:27.374: W/dalvikvm(20897): threadid=1: thread exiting with uncaught exception (group=0x40a381f8) 10-26 07:34:27.384: I/DEBUG(20910): Received buf=[5]20897 10-26 07:34:27.384: E/AndroidRuntime(20897): FATAL EXCEPTION: main ... 10-26 07:34:27.414: W/ActivityManager(83):   Force finishing activity com.FIFTYmegs.roeug/.LCLActivity 10-26 07:34:27.424: W/WindowManager(83): Failure taking screenshot for (180x296) to layer 21030 10-26 07:34:27.524: W/ApplicationContext(83): Unable to create files directory files 10-26 07:34:27.724: I/Process(83): Sending signal. PID: 20897 SIG: 3 10-26 07:34:27.724: I/dalvikvm(20897): threadid=3: reacting to signal 3 Thought in AndroidManifest.xml  I have         ---------------------------------------------------------------------- Fortuna1 · 2012-10-26 17:00 Made apk. How did you do apk. Which version you use Lazarus? (the version here should be of the installed Windows compiler, not the version of the cross-compiler, so might be 2.6.0 or 2.7.1 or something else) ---------------------------------------------------------------------- roeug · 2012-10-27 07:57 lazarus-1.0.2-fpc-2.6.0-win32 fpc4android_2_5_1_2_apr_2012.zip (\units\arm-linux; bin\i386-win32\ppcrossarm.exe and arm-linux-*.exe 2.5.1) ---------------------------------------------------------------------- Fortuna1 · 2012-10-27 16:13 Try with http://mirrors.iwi.me/lazarus/snapshots/ This is beter solutions. mirrors.iwi.me/lazarus/snapshots/Lazarus-1.1-39124-fpc-2.7.1-20121018- win32.exe ---------------------------------------------------------------------- Fortuna1 · 2012-10-27 16:23 1) step    Lazurs make   liblclapp.so 2) generate_debug_key 3) build_debug_apk  // make apk 3) IF compile  androidlcltest project  the name is androidlcltest.apk copy androidlcltest.apk in your android or  start corect AVD emulator I use android 2.2. API Level 8 ---------------------------------------------------------------------- Fortuna1 · 2012-10-27 16:51 In execution I have "unfortunately has stopped This is not done, I think that you did not properly build apk. You must get  name androidlcltest.apk and not unfortunately Publish your console   of  build_debug_apk.bat. I thing that you forget edit build_debug_apk.bat Change correct  XXXXXXX jarsigner -verbose -keystore bin\LCLDebugKey.keystore -keypass XXXXXX -storepass XXXXXX -signedjar bin\%APP_NAME%-unaligned.apk bin\%APP_NAME%-unsigned.apk LCLDebugKey  use  correct user and password  generation with  generate_debug_key. ---------------------------------------------------------------------- roeug · 2012-10-30 06:25 I tried Lazarus-1.1-39124-fpc-2.7.1-20121018-win32.exe but result is the same: emulator says "unfortunately has stopped [OK]" I used ppcrossarm.exe  and lazarus\fpc\2.5.1\units\arm-linux from fpc4android_2_5_1_2_apr_2012.zip ADDED: Interesting that compiled apk  lazarus\examples\androidlcl\android\bin\androidlcltest.apk gives the same "unfortunately has stopped [OK]" ---------------------------------------------------------------------- Leledumbo · 2012-11-15 16:44 From the log: Quote10-26 07:34:27.014: I/lclapp(20897): Trying to load liblclapp.so 10-26 07:34:27.054: E/lclapp(20897): WARNING: Could not load liblclapp.so 10-26 07:34:27.054: W/System.err(20897): java.lang.UnsatisfiedLinkError: Couldn't load lclapp: findLibrary returned nullDo you change the output filename (-o)? The .so name is hardcoded in the java wrapper. ---------------------------------------------------------------------- roeug · 2012-11-16 04:46 "Do you change the output filename (-o)? The .so name is hardcoded in the java wrapper." Sorry. What exactly have I to do (manually rename which file or what)? ---------------------------------------------------------------------- Leledumbo · 2012-11-16 12:26 QuoteWhat exactly have I to do (manually rename which file or what)?IF you change the output filename, then you can manually rename in android/libs/go/to/the/deepest/dir/libyourapp.so to liblclapp.so. Otherwise, change all instance of "lclapp" (don't really have to, but can avoid confusion) in LCLActivity.java (just search the file, I forget the location). ---------------------------------------------------------------------- roeug · 2012-11-19 06:07 >The .so name is hardcoded in the java wrapper. ¬   Got it. > Do you change the output filename (-o)? No, I am in trying to apk androidlcltest "as is" from ./examples (sure, with my paths and debug_key). Just no success in emulator ---------------------------------------------------------------------- Leledumbo · 2012-11-19 16:09 Try this in your emulator, compiled on my machine. ---------------------------------------------------------------------- roeug · 2012-11-20 06:33 It works The sizes are LCLExample-debug.apk = 1386247, (my) androidlcltest.apk=1429764 ---------------------------------------------------------------------- roeug · 2012-11-22 07:55 Result LCL test installed and runs (at the moment with black screen) Lazarus 1.02 FPC 2.6.0 1) fpc4android_2_5_1_2_apr_2012.zip       *.exe -> …lazarusfpc260\fpc\2.6.0\bin\i386-win32  units - > …lazarusfpc260\fpc\2.5.1\units\arm-linux 2) Project/Target file name (-o) WAS android\libs\armeabi\liblclapp.so MUST be android\libs\armeabi\liblclapp (NO EXTENTION so) 3) Edit generate_debug_key.bat, build_debug_apk.bat - SET PATH…SET ANDROID_HOME…SET APK_SDK_PLATFORM….SET APK_PROJECT_PATH… (psws – senhas –remain) ---------------------------------------------------------------------- roeug · 2012-11-26 08:03 Result2 LCL test installed and runs Lazarus-1.1-39105-fpc-2.6.1-20121017-win32.exe 1) fpc4android_2_5_1_2_apr_2012.zip       *.exe -> …lazarusfpc260\fpc\2.6.1\bin\i386-win32  units - > …lazarusfpc260\fpc\2.5.1\units\arm-linux 2) Project/Target file name (-o) WAS android\libs\armeabi\liblclapp.so MUST be android\libs\armeabi\liblclapp (NO EXTENTION so) 3) Edit generate_debug_key.bat, build_debug_apk.bat - SET PATH…SET ANDROID_HOME…SET APK_SDK_PLATFORM….SET APK_PROJECT_PATH… (psws – senhas –remain) androidlcl  – runs OK