How do I get AndroidMode work?

edited July 21 in Android Mode

I'm having a lot of trouble with processing for android... can anybody help me? I haven't found a solution yet:

-Once I've installed AndroidMode, and I try to run my sketch I receive 14 error messages about some importation problems like 'The import java.io.IOException is never used'.

-When I write some predefined functions like size(); the console returns 'The function size() does not exist'.

-Also, even my phone is connected processing doesn't recognise it at appears "no connected devices". I have tried a lot of things.

My phone is an LG G3 stylus with lollipop, I'm working in Mac, what's my problem?

@kfrajer I've seen you're good in this, can you help me? or anyone... Please!

Answers

  • The import java.io.IOException is never used

    Those are warnings. You need to check closely and differentiate warnings from errors. Then you tackle the errors

    When I write some predefined functions like size(); the console returns 'The function size() does not exist'.

    It is a known bug that when Using Processing in Android mode, the common words get highlighted as if they were wrong. Just ignore it.

    I don't have a mac or experience with mac troubleshooting, but I can certainly help as time permits.

    First of all, can you tell us what Processing version you are using? Android Mode version? (Open Add mode and click in your Android mode line. At the bottom of the dialog box you will see a number associated to the mode.)

    How did you install your Android SDK? Manually or through Processing. There is an issue with the latest release of Android SDK. I am not sure if it has been resolved yet so I will err on the side of caution and proceed to do a manual download and then setup the old version of Android tools. To do this, I have to look for a previous post that describe the step by step procedure. First, let me know how you install your Android SDK (what version you have btw... from the help>>about menu). Also, what Android API do you have install in your Android SDK. Then.. based on the former info, I can provide you the link.

    Please, also tell us if you have run Android Apps in your phone before, using Eclipse or AS for instance.

    Lastly, what sample code are you trying to run? Are you familiar with the How to start guide in the Processing Foundation's page under the Android section? It is a good place to start, or at least to be familiar with those instructions.

    Kf

  • edited July 19

    @kfrajer

    I installed the SDK through Processing, I'm using Processing version 3.3.5, with AndroidMode 3.0.2, I'm using Android 8.0.0(API 26).

    The program I'm trying to run is pretty simple:

    Player myPlayer = new Player();
    
    void setup() {
      size(displayWidth,displayHeight);
      orientation(LANDSCAPE);
    }
    
    class Player{
      int gravity;
      int altitude;
      Player() {
        this.altitude = height/2;
        this.gravity = 0;
      }
      void drawBall() {
        this.altitude += this.gravity;
        fill(255);
        rect(width/2, this.altitude, 20, 20);
      }
    }
    
    void draw() {
      background(0);
    
      if(mousePressed) {
        myPlayer.gravity = -3;
      } else {
        myPlayer.gravity = 3;
      }
    }
    

    And I haven't run any other app in my phone before, I followed the instructions in Start Guide from Android in Processing.org but it didn't work.

    I have tried running an example but I receive this error: "cannot connect to daemon"

  • I have to say I don't have experience with Mac systems so I am not sure what steps you will need to follow to get it running or to resolve your issues. Hopefully some other forum goer can assist you in your task. If I were you, I will trying setting up AS and get a simple demo running there. The reason of using AS is because there should be more information out there (guides) to setup and run Android Apps in mac machines. After you get it running in your mac, then you can switch to Processing and give it a try. If you are using the latest Android SDK, you might need to downgrade it as I believe Processing still needs the ant script to compile your Android app. However, those "ant" scripts are not available in the latest release of the Android SDK.

    More in this post: https://forum.processing.org/two/discussion/21347/gsoc-17-participation#latest

    And check the steps provided by @Digl on March 30 in this post: https://forum.processing.org/two/discussion/21588/running-sketches-on-my-smartphone-does-not-work-anymore#latest

    Kf

  • @Rivers===

    • dont worry about the red warnings: processing import by default a lot of java libs which are useless in many cases

    • download and install (modes folder) the android package; dont use the other way (automatically, from P5)

    • as for mac i dont think that it is a problem, except of course that you have to be sure that you have installed the jdk or jre, and set the security rules as you want; notice that by default Apple forbids to launch any app which was not downoaded from the apple store. Verify these points in your preferences menu(system): is java present (it must be at the bottom of the window)? What about security (window security).

  • edited July 28

    @Rivers I noticed in your sketch you have variables in the size function, you can't have those as variables, they must be actual numbers.

    EDIT: never mind, it seems those are indeed valid in that case sorry.

Sign In or Register to comment.