Forum > Android

[solved]Unable to build apk under windows

(1/5) > >>

huberte:
I followed http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Step_4_-_Creating_the_APK_package_in_Windows, with the latest svn from Lazarus. Here are the "bugs" when I try to build the apk for "example\androidlcl"


--- Quote ---D:\Svendi\Lazarus\Android\androidlcl3tbn\android>call javac -verbose -classpath D:\Svendi\Lazarus\Programmes\android-sdk\platforms\android-15\android.jar -d bin\classes src\com\pascal\lclbtn\LCLActivity.java
src\com\pascal\lclbtn\LCLActivity.java:341: error: unmappable character for encoding Cp1252
    localpaint.getTextBounds("├?qg", 0, 3, localbounds);
                               ^
--- End quote ---

In this file you have a strange caracter on line 341

Deleting it (yep I know :)) and trying to relauch ends with http://pastebin.com/MQmy5cpK

felipemdc:
It is not a bug in my code, Java should not do that conversion of Unicode->CPsomething. Maybe we are missing some kind of option for javac which will tell it to use Unicode only.

Your Windows is for which language?

huberte:
french. why would it be related with the windows french languague ? I did check the java gile it's encoded in UTF8 (see the file)


--- Quote ---    lclwidth = lclwidth + (3 * lcltextsize) / 16;
    // Don't use just localbounds.height() from the source text
    // because it will calculate the minimum necessary height,
    // but we can't easily use that to draw text because it draws relative to the baseline
    localpaint.getTextBounds("Íqg", 0, 3, localbounds);
    lclheight = localbounds.height();
--- End quote ---

and then why those all bugs ? (paste.bin)

felipemdc:

--- Quote from: huberte on April 27, 2012, 12:35:08 pm ---french. why would it be related with the windows french languague ? I did check the java gile it's encoded in UTF8 (see the file)
--- End quote ---

The error comes from your Java JDK, in my computer there is no error. I have an polish Windows here. Why would it choose this particular encoding for the file? The JDK probably choose the Windows encoding to use for the file.

I read here: http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javac.html

And they say that there is a -encoding directory to javac. Could you try adding "-encoding utf8" or "-encoding utf-8" to the javac call in the batch file and see if this fixes the issue?


--- Quote ---and then why those all bugs ? (paste.bin)
--- End quote ---

You are probably using a non-UTF-8 editor. Use Lazarus to open the file and you will see that the string is correct. You can also use a hexadecimal editor to check that it is correct.

huberte:
No error with :

--- Quote ----verbose -classpath %APK_SDK_PLATFORM%\android.jar -d bin\classes -encoding utf8 src\com\pascal\lcltest\LCLActivity.java
--- End quote ---

I will add this to the wiki

Like I said there were others error (see the paste bin links after), this one occurs :

--- Quote ---D:\Svendi\Lazarus\Android\androidlcl\android>call dx --dex --verbose --output=D:\Svendi\Lazarus\Android\androidlcl\android\bin\classes.dex D:\Svendi\Lazarus\Android\androidlcl\android\bin\classes
processing D:\Svendi\Lazarus\Android\androidlcl\android\bin\classes\.\com\pascal\lcltest\LCLActivity$1.class...

trouble processing:
bad class file magic (cafebabe) or version (0033.0000)
...while parsing com/pascal/lcltest/LCLActivity$1.class
...while processing com/pascal/lcltest/LCLActivity$1.class
processing D:\Svendi\Lazarus\Android\androidlcl\android\bin\classes\.\com\pascal\lcltest\LCLActivity$2.class...
--- End quote ---

This error occurs with 10 warnings

Then this


--- Quote ---D:\Svendi\Lazarus\Android\androidlcl\android>REM Now build the unsigned APK

D:\Svendi\Lazarus\Android\androidlcl\android>del D:\Svendi\Lazarus\Android\androidlcl\android\bin\androidlcltest-unsigned.apk
Impossible de trouver D:\Svendi\Lazarus\Android\androidlcl\android\bin\androidlcltest-unsigned.apk

D:\Svendi\Lazarus\Android\androidlcl\android>call apkbuilder D:\Svendi\Lazarus\Android\androidlcl\android\bin\androidlcltest-unsigned.apk -v -u -z D:\Svendi\Lazarus\Android\androidlcl\android\bin\andr
oidlcltest.ap_ -f D:\Svendi\Lazarus\Android\androidlcl\android\bin\classes.dex

THIS TOOL IS DEPRECATED. See --help for more information.
--- End quote ---

thks

Navigation

[0] Message Index

[#] Next page

Go to full version