Recent

Author Topic: Porting Win(WinCE) App to android How to debug it?  (Read 13662 times)

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Porting Win(WinCE) App to android How to debug it?
« on: October 25, 2012, 09:12:16 am »
I an in porting Win(WinCE) App to android
Host OS Windows
Compiled
Made apk
Installed to Emulator

In execution I have "unfortunately <aap_name> has stopped [OK]"

1. How to debug it?
2. How to add binary file to be used in my application?


roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #1 on: October 26, 2012, 08:38:26 am »
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
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
« Last Edit: October 26, 2012, 09:58:55 am by roeug »

Fortuna1

  • Full Member
  • ***
  • Posts: 164
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #2 on: October 26, 2012, 07:00:14 pm »
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)



« Last Edit: October 26, 2012, 07:11:01 pm by Fortuna1 »

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #3 on: October 27, 2012, 09:57:10 am »
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)
« Last Edit: October 27, 2012, 10:03:11 am by roeug »


Fortuna1

  • Full Member
  • ***
  • Posts: 164
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #5 on: October 27, 2012, 06:23:08 pm »
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

  • Full Member
  • ***
  • Posts: 164
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #6 on: October 27, 2012, 06:51:11 pm »
In execution I have "unfortunately <aap_name> has stopped
This is not done,

I think that you did not properly build apk.


You must get  name androidlcltest.apk and not unfortunately <aap_name>

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.


« Last Edit: October 27, 2012, 07:31:10 pm by Fortuna1 »

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #7 on: October 30, 2012, 07:25:49 am »
I tried Lazarus-1.1-39124-fpc-2.7.1-20121018-win32.exe but result is the same: emulator says "unfortunately <ap_name> 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 <ap_name> has stopped [OK]"
« Last Edit: October 31, 2012, 05:37:37 am by roeug »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #8 on: November 15, 2012, 05:44:32 pm »
From the log:
Quote
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
Do you change the output filename (-o)? The .so name is hardcoded in the java wrapper.

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #9 on: November 16, 2012, 05:46:32 am »
"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

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #10 on: November 16, 2012, 01:26:58 pm »
Quote
What 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

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #11 on: November 19, 2012, 07:07:23 am »
>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

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #12 on: November 19, 2012, 05:09:21 pm »
Try this in your emulator, compiled on my machine.

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #13 on: November 20, 2012, 07:33:39 am »
It works
The sizes are LCLExample-debug.apk = 1386247, (my) androidlcltest.apk=1429764
« Last Edit: November 20, 2012, 11:05:13 am by roeug »

roeug

  • Jr. Member
  • **
  • Posts: 67
    • http://roeug.50megs.com/
Re: Porting Win(WinCE) App to android How to debug it?
« Reply #14 on: November 22, 2012, 08:55:31 am »
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)


« Last Edit: November 22, 2012, 08:57:32 am by roeug »

 

TinyPortal © 2005-2018