GLBasic forum

Main forum => GLBasic - en => Topic started by: Paul Smith on 2011-Sep-12

Title: Android compiling Problems
Post by: Paul Smith on 2011-Sep-12
After my current phone melted itself, I'm tempted to buy an  Android phone
before I recompile my old projects I thought I would test it out on some samples e.g helloworld( all compile in   w32 and Win-CE )
I'm getting the errors listed below then compiling
Ive followed the installation instructions and set environment paths etc
any Ideas what Im missing.

Win 7 64bit
java sdk 32 (tried 1.7 & 1.6)
android sdk (installed everything)


_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.8.048 SN:681be9d9 - 3D, NET
Wordcount:4 commands
compile+link:
BUILDSRIPT
BUILD STAGE 1: Compile and pack
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
    [javac] C:\Users\Paul6175\Documents\GLBasic\GLBasic\Samples\Basics\distribute\Android\gen\com\.helloworld\R.java:8: malformed floating point literal
    [javac] package com..helloworld;
    [javac]            ^
    [javac] 1 error

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:386: Compile failed; see the compiler error output for details.

Total time: 3 seconds
BUILD STAGE 2: Install on device
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
    [javac] C:\Users\Paul6175\Documents\GLBasic\GLBasic\Samples\Basics\distribute\Android\gen\com\.helloworld\R.java:8: malformed floating point literal
    [javac] package com..helloworld;
    [javac]            ^
    [javac] 1 error

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:386: Compile failed; see the compiler error output for details.

Total time: 3 seconds
Android=C:\Users\Paul6175\Documents\GLBasic\GLBasic\Samples\Basics\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 12.7 sec. Time: 17:11
Build: 1 succeeded.



Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Sep-12
Is there anything odd in the project name ?  Can you make it available ?

Android is very strict about names unfortunately (and also doesn't tend to like spaces)
Title: Re: Android compiling Problems
Post by: Paul Smith on 2011-Sep-12
No spaces or symbols.
All I'm compiling at the moment is a simple hello world
new project "antest.gbas"

// --------------------------------- //
// Project: antest
// Start: Monday, September 12, 2011
// IDE Version: 10.106



PRINT "test test", 0, 50;
SHOWSCREEN
END
Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Sep-12
Its all fine here :

Code (glbasic) Select
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.8.048 SN:47ccc3f7 - 3D, NET
Wordcount:3 commands
compile+link:
BUILDSRIPT
BUILD STAGE 1: Compile and pack
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\Nicholas\Documents\GLBasic\GLBasic\antest\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] No key.store and key.alias properties found in build.properties.
     [echo] Please sign C:\Users\Nicholas\Documents\GLBasic\GLBasic\antest\distribute\Android\bin\glbasic-unsigned.apk manually
     [echo] and run zipalign from the Android SDK tools.


I notice your path :

Code (glbasic) Select
C:\Users\Paul6175\Documents\GLBasic\GLBasic\Samples\Basics\distribute\Android\gen\com\.helloworld\R.j

is very odd
Title: Re: Android compiling Problems
Post by: trucidare on 2011-Sep-12
try to add a company name in project settings
Title: Re: Android compiling Problems
Post by: Paul Smith on 2011-Sep-12
Uninstalled everything and deleted all environment for java/android
reinstalled and set up all.
made new project but saved it onto my desktop, also gave it a company name.
Got a better log this time.
2 errors at end not sure what they mean.
set up an AVD not sure how to project to run on the emulator yet, will need to read more instructions.

thanks for the help.

_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.8.048 SN:681be9d9 - 3D, NET
Wordcount:3 commands
compile+link:
BUILDSRIPT
BUILD STAGE 1: Compile and pack
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\Paul6175\Desktop\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] No key.store and key.alias properties found in build.properties.
     [echo] Please sign C:\Users\Paul6175\Desktop\distribute\Android\bin\glbasic-unsigned.apk manually
     [echo] and run zipalign from the Android SDK tools.

BUILD SUCCESSFUL
Total time: 8 seconds
BUILD STAGE 2: Install on device
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\Paul6175\Desktop\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] Running zip align on final apk...
     [echo] Debug Package: C:\Users\Paul6175\Desktop\distribute\Android\bin\glbasic-debug.apk
     [echo] Installing C:\Users\Paul6175\Desktop\distribute\Android\bin\glbasic-debug.apk onto default emulator or device...

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:641: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:271: exec returned: 1

Total time: 10 seconds
Android=C:\Users\Paul6175\Desktop\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 26.4 sec. Time: 22:16
Build: 1 succeeded.

Title: Re: Android compiling Problems
Post by: okee on 2011-Sep-13
QuoteAfter my current phone melted itself, I'm tempted to buy an  Android phone

Do you have an Android device connected ?
That's the error I get if no device is connected, or windows can't find the phone


Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Sep-13
Yes, it doesn't matter if the second stage fails.
Title: Re: Android compiling Problems
Post by: Falstaff on 2011-Sep-14
If you can get your emulator running (it may take a *long* time to boot, mine does), it should show up as a connected android device. Once you have a device connected, just doing a build for android should make it automatically install onto your connected device(/emulator). You can of course alternatively connect a phone/tablet and it would install onto it too.

You can check your recognized connected devices with the command "adb devices". You need your environment paths setup right of course, I think that's a command from the androidsdk tools directory. The emulator should show up after it's finished booting up.

Also if/when you get a real device, be sure to install whatever drivers are relevant before you connect the device. I didn't do that before hooking up my asus transformer and it wouldn't recognize to adb (or glbasic) until I found an app to remove usb drivers.. annoying.
Title: Re: Android compiling Problems
Post by: ketil on 2011-Oct-02
Was this issue solved ?
I have the exact same problems.
Phone-model = HTC Legend
Title: Re: Android compiling Problems
Post by: ketil on 2011-Oct-02
I fixed it :)

1. reinstalled htc's usb drivers.

2. set the JAVA_HOME path to shortform:
ex:
C:\Progra~2\Java\jdk1.7.0
instead of:
C:\Program Files (x86)\Java\jdk1.7.0

It seem like the spaces in the JAVA_HOME string was the problem.
Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Oct-02
Yup - no spaces allowed :)
Title: Re: Android compiling Problems
Post by: AMateus on 2011-Oct-02
I have android sdk working and the java_home environment variable has spaces =) go figure :P
Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Oct-02
Also, no spaces are allowed in the project directory path...
Title: Re: Android compiling Problems
Post by: ketil on 2011-Oct-03
Maybe it's an idea for windows users to use mklink (vista and above) for symbolic folderlinks at the root-level to preserve paths that is shared with other resources, such at the JAVA_HOME variable.
Title: Re: Android compiling Problems
Post by: Kitty Hello on 2011-Oct-04
very strange. I have spaces in both and it works.
Title: Re: Android compiling Problems
Post by: matchy on 2011-Oct-10
I was wondering :noggin:, when the device is connected via USB a compile and run is successful. When running the same install apk file again on the device (downloaded via smb/ftp), it can not install successfully. How can it install without USB? Is extra signing required to distribute like this?
Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Oct-10
That is odd - unless of course, your device isn't set to allow third party installations...
Title: Re: Android compiling Problems
Post by: matchy on 2011-Oct-10
This device doesn't connect via USB currently although it has before. I'll need to retest it with another device that does connect/htc sync on USB and awaiting response from a third.

Here is the test app if you would like to test:

http://mixer.homeip.net/temp/pendulum_v1.rar
(temp link to be removed later)
Title: Re: Android compiling Problems
Post by: turnerb on 2011-Oct-13
I am also having this problem on a Motorola Photon 4G.  To test I built the Arkanoid sample, it installs to the emulator just fine.  I have JAVA_HOME with no spaces, and I have ensured my phone allows applications from unknown sources...  still get the following failure (even though it says it succeeds...)

_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.10.074 SN:71691f45 - 3D, NET
Wordcount:119 commands
compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] No key.store and key.alias properties found in build.properties.
     [echo] Please sign C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android\bin\glbasic-unsigned.apk manually
     [echo] and run zipalign from the Android SDK tools.

BUILD SUCCESSFUL
Total time: 3 seconds
BUILD STAGE 2: Install on device
     [echo] Creating output directories if needed...
     [echo] Compiling aidl files into Java classes...
     [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
     [echo] Generating R.java / Manifest.java from the resources...
     [echo] Converting compiled files and external libraries into C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android\bin\classes.dex...
     [echo] Packaging resources
     [echo] Running zip align on final apk...
     [echo] Debug Package: C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android\bin\glbasic-debug.apk
     [echo] Installing C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android\bin\glbasic-debug.apk onto default emulator or device...

BUILD FAILED
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:641: The following error occurred while executing this line:
Q:\Compiler\platform\android\android-sdk-windows\tools\ant\main_rules.xml:271: exec returned: 1

Total time: 7 seconds
finished Android build-script.
Android=C:\Users\turnerb\Documents\GLBasic\GLBasic\Samples\_Projects_\Arkanoid\distribute\Android
success
_______________________________________
*** Finished ***
Elapsed: 18.4 sec. Time: 16:03
Build: 1 succeeded.

Spent some time trying to figure this out, but I am out of idea's.  Anyone else powered through this error?
Title: Re: Android compiling Problems
Post by: okee on 2011-Oct-13
It's not finding your device, do you have the windows drivers installed ?

To check if it's connected properly
get the path to adb.exe in the android folder, on mine its in the folder:
C:\Program Files (x86)\Android\android-sdk\platform-tools
open a command prompt and type:

path C:\Program Files (x86)\Android\android-sdk\platform-tools

then type:

adb devices

and it will show what devices are attached i.e.
Code (glbasic) Select
List of devices attached
P729J_SBM      device


If no device is detected and you have your android device attached
power it off and on and reconnect and check you have the right drivers


okee
Title: Re: Android compiling Problems
Post by: turnerb on 2011-Oct-14
That fixed it.  I had no idea for Android development you have to go get the USB device drivers from each manufacturer (Motorola, HTC, LG, etc...) to do development.  In my case, I had to install from http://developer.motorola.com/docstools/USB_Drivers/. 

All is working well now.

Thanks for the tip about using ADB.exe Devices to find the devices that were attached.  That is how I knew the issue was fixed.  Before I got the driver, it said there were no devices, after I installed the driver, it showed my device.

Thanks
Title: Re: Android compiling Problems
Post by: MrTAToad on 2011-Oct-14
Yes, Google dont make things easy...
Title: Re: Android compiling Problems
Post by: Wampus on 2011-Nov-24
I'm getting this error today on both computers I connect to my Android phone. Was working fine until this morning. Nothing was changed by me on the device or the computers. Since then I've tried changing the settings on the phone but I'm still seeing no devices being recognised. So strange.

Updating the terrible software Samsung supply with the phone and may reinstall the driver altogether. Maybe that will improve matters.
Title: Re: Android compiling Problems
Post by: Wampus on 2011-Nov-24
After HOURS OF PAIN (http://www.youtube.com/watch?v=01vfavRV_aE) I found that the goddamn USB cable was bad! Came with some cheap aftermarket charger and I had no idea I'd picked that one up instead of the standard cable.
Title: Re: Android compiling Problems
Post by: Marmor on 2011-Nov-25
 :noggin:my best usb cable are from palm/hp and comes with the touchpad/pre
get some frome hp /palm on ebay its a bit bigger as the others because the Devices need 2A  :good: