Forum

Problems with kontrolleur on android 4


#1

hiya! so i bought a shiny new htc one x (maybe that causes the problem) with android 4.0.3 (i guess that causes the problem) and the sad news is kontrolleur won’t start but throws an exception: (i’ve downloaded it from google play (alias android market) is that up-to-date?)

Exception class name: java.lang.ArrayIndexOutOfBoundsException
Source file: Kontrolleur.java
Source class: processing.android.test.kontrolleur.Kontrolleur
Source method: getTargetIP
Line number: 788

Stack trace:

java.lang.ArrayIndexOutOfBoundsException: length=1;
index=1
  at processing.android.test.kontrolleur.Kontrolleur.getTargetIP(Kontrolleur.java:788)
  at processing.android.test.kontrolleur.Kontrolleur.initMenu(Kontrolleur.java:216)
  at processing.android.test.kontrolleur.Kontrolleur.setup(Kontrolleur.java:216)
  at processing.core.PApplet.handleDraw(Unknown Source)
  at processing.core.PGraphics.Android2D.requestDraw(PGraphicsAndroid2D.java:161)
  at processing.core.PApplet.run(Unknown Source)
  at java.lang.Thread.run(Thread.java:864)

i don’t know if the source of the problem is coming from processing or it can be corrected in kontrolleur. anybody can confirm this with android 4?


#2

i don’t have an android4 device here and kontrolleur was last built around a year ago with an older processing version. so maybe it just needs a rebuild and possible minor adaptions. sources are here: https://github.com/vvvv/Kontrolleur


#3

thanks! well i’ve downloaded and installed processing (2.0a5) for android and the necessary android sdk platforms and when i try to compile Kontrolleur i get this:

BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:651: The following error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:672: Compile failed; see the compiler error output for details.

Total time: 1 second

Buildfile: C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\build.xml

-set-mode-check:

-set-debug-files:

-set-debug-mode:

-debug-obfuscation-check:

-setup:
     [echo](echo) Creating output directories if needed...
    [mkdir](mkdir) Created dir: C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\bin
    [mkdir](mkdir) Created dir: C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\bin\res
     [echo](echo) Gathering info for Kontrolleur...
    [setup](setup) Android SDK Tools Revision 19
    [setup](setup) Project Target: Android 2.3.3
    [setup](setup) API level: 10
    [setup](setup) 
    [setup](setup) ------------------
    [setup](setup) Resolving library dependencies:
    [setup](setup) No library dependencies.
    [setup](setup) 
    [setup](setup) ------------------
    [setup](setup) API<=15: Adding annotations.jar to the classpath.
    [setup](setup) 
    [setup](setup) ------------------

-build-setup:
    [mkdir](mkdir) Created dir: C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\gen
    [mkdir](mkdir) Created dir: C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\bin\classes

-pre-build:

-code-gen:
     [echo](echo) ----------
     [echo](echo) Handling aidl files...
     [aidl](aidl) No AIDL files to compile.
     [echo](echo) ----------
     [echo](echo) Handling RenderScript files...
[renderscript](renderscript) No RenderScript files to compile.
     [echo](echo) ----------
     [echo](echo) Handling Resources...
     [aapt](aapt) Generating resource IDs...
     [echo](echo) ----------
     [echo](echo) Handling BuildConfig class...
[buildconfig](buildconfig) Generating BuildConfig class.

-pre-compile:

-compile:
    [javac](javac) Compiling 3 source files to C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\bin\classes
    [javac](javac) C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\src\changethispackage\beforesubmitting\tothemarket\kontrolleur\Kontrolleur.java:1142: cannot find symbol
    [javac](javac) symbol  : class XMLElement
    [javac](javac) location: class changethispackage.beforesubmitting.tothemarket.kontrolleur.Kontrolleur
    [javac](javac)   XMLElement settings = new XMLElement(CSaveTag);
    [javac](javac)
    [javac](javac) C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\src\changethispackage\beforesubmitting\tothemarket\kontrolleur\Kontrolleur.java:1142: cannot find symbol
    [javac](javac) symbol  : class XMLElement
    [javac](javac) location: class changethispackage.beforesubmitting.tothemarket.kontrolleur.Kontrolleur
    [javac](javac)   XMLElement settings = new XMLElement(CSaveTag);
    [javac](javac)
    [javac](javac) C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\src\changethispackage\beforesubmitting\tothemarket\kontrolleur\Kontrolleur.java:1165: cannot find symbol
    [javac](javac) symbol  : class XMLElement
    [javac](javac) location: class changethispackage.beforesubmitting.tothemarket.kontrolleur.Kontrolleur
    [javac](javac)     XMLElement settings = XMLElement.parse(br);
    [javac](javac)
    [javac](javac) C:\Users\nmd\AppData\Local\Temp\android5769851830338100644sketch\src\changethispackage\beforesubmitting\tothemarket\kontrolleur\Kontrolleur.java:1165: cannot find symbol
    [javac](javac) symbol  : variable XMLElement
    [javac](javac) location: class changethispackage.beforesubmitting.tothemarket.kontrolleur.Kontrolleur
    [javac](javac)     XMLElement settings = XMLElement.parse(br);
    [javac](javac)
    [javac](javac) 4 errors

I’m not a processing or android expert what can i do now?


#4

ahm, seems there’ve been some changes regarding XMLElement on the processing side, see: http://forum.processing.org/topic/xmlelement-just-not-working


#5

damn that doesn’t seem to be a straight change in the code. well i’ll try to change that to the new XML class or what but i can’t promise too much

Update: ok i don’t have a single idea how to do that


#6

Hi
I tried on my Nexus One and it works.
S.


#7

… i am on 4.0.4


#8

it works somehow on my galaxy nexus but:

-you have to turn off the 3g connection OR the wireless lan, otherwise the app will not start up. seems it has troubles with 2 ip adresses.

-you cannot enter an ip adress because the entryfield doesnt accept dots!! quite stupid :(


#9

so i took elektromeier’s advice and it turned out it has trouble if the phone HAS an ip address. i mean it works only if i turn off wifi, 3g, and turn on airplane mode but as soon as i turn the wifi back on (and only the wifi) kontrolleur crashes. and it’s quite meaningless without wifi.


#10

@microdee i fixed the xml-stuff and hopefully the wifi/3g crash. can you test on your device? source only for now. tested with processing 2.0a6
(only atm doesn’t seem to save/load settings)


#11

sorry for late response i’m quite busy nowadays now it compiles nicely if there’s no wifi it runs nicely however it produces the same error as before. probably it will be something with the processing side. i spoke some people who are into android development and they said there were some changes in android 4.x which makes some apps incompatible with it what ran on previous android versions. they also said developing for android is a mess and its sdk is a hellhole :D

update: oops i had 2 IP addresses probably from usb debugging or htc sync i dunno i’m figuring out how to make an .apk file from the sketch

update2: getLocalIP() caused the problem. i’ll try to add a textbox or something, like with target IP address. i’ve just wrote FLocalIP = “127.0.0.1” for now and it works as it should. of course there’s no feedback to the phone now


#12

ok, will hopefully get an android4 device soon and will check. thanks so far.


#13

created the textbox and the settings xml entry and now IT WORKS in both directions!


#14

oui, still no device to test, but i found another way to detect the local IP that didn’t work for me before my android 2.3.7 update. works now, please retest.