Signed Package export isues

I can’t figure out how to export a signed package. the first time i tried i got a message saying i needed to change the name in the XML file. after doing so it then wanted me to “add an icon to the sketch folder” after adding a screenshot to the folder (just under the .pde) but it still didn’t like it. so I added three. then another three to the data folder. still nothing. what do i have to do?

Have you seen this: https://android.processing.org/tutorials/distributing/index.html

1 Like

Hi, I just started programming Processing for Android. Bought a book (ISBN 978-1-4842-2718-3 52499) which was very useful while writing my program.
I spent approx 1 day writing and debugging my program. Works as a charm when my phone Samsung SM J320 is connected to my PC.
I wrongly assumed that publishing the packaging would be a piece of cake…
(I just want to run my program stand-alone on the phone)
Yes I read my book and googled for a example or information.
The problem is that for a beginner there is no consolidated information available (by my knowledge)
So yes I have the same issue as gimly1000…
Yes I saw the link:
https://android.processing.org/tutorials/distributing/index.html
First problem is that the manifest produces:

 <application android:icon="@mipmap/ic_launcher" android:label="">

While the documentation states:

<application android:icon="@drawable/icon" android:label="">

While exporting you get the message as stated in the question of gimly1000 but the link pointing to the solution in de Processing IDE is not working…

My aim is not to point out for inconsistencies but I really in search for help.
I am now searching for 4 days for a solution. The program serves as a communication aid with my mother in law. She is unable to speak and her medical condition deteriorates quickly. This put some extra stress.
If somebody can point me in the right direction I will be very grateful!
Below the program I wrote with snippets from other examples (for whose it can be of use in the same situation as I am).

import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import java.util.Locale;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.speech.RecognizerIntent;
import android.content.*; 

ArrayList <SimpleButton> buttonList; 

String[] buttonLabel = {"Ochtend", "Middag", "Avond", "Nacht", "Hallo", "Ja", "Neen", "Goed", "OK", "Slecht", "Beter", "WC", "Eten", "Slapen", "Dutje", "Dank u", "U OK?"};
String[] str = {"Goedemorgen", "Goede middag", "Goede avond", "Goede nacht", "Hallo", "Ja", "Neen", "Goed", "OK", "Slecht", "Ik voel me wat beter", "Ik zou naar de WC willen gaan. Kan u me helpen?", "Ik had graag iets te eten gekregen", "Ik voel me wat moe, ik zou graag willen slapen", "Ik knap even een uiltje", "Dank u wel", "Hoe gaat het met u?"};

TextToSpeech my_tts;
Activity activity;
Context context;

int buttonID;

void setup() {
  fullScreen();
  background(0, 0, 200);
  fill(200);
  int perline = 3;
  float buttonWidth = width/perline;
  float buttonHeight = width/6 ;
  float yPos = 0 ;
  buttonList = new ArrayList<SimpleButton>(); 
  for (int i=0; i<buttonLabel.length; i++) {
    buttonList.add(new SimpleButton((i%perline)*buttonWidth, yPos+int(i/perline)*buttonHeight, buttonWidth, buttonHeight, buttonLabel[i]));
  }
  textSize(40);
  textAlign(CENTER, CENTER);
  for (int i=0; i<buttonLabel.length; i++) {
    SimpleButton button = buttonList.get(i);
    button.display();
  }
  activity = this.getActivity();
  context = activity.getApplicationContext();
}

void draw() {
}

void mousePressed() {
  for (int i=0; i<buttonLabel.length; i++) {
    buttonID = i;
    SimpleButton button =  buttonList.get(buttonID);
    if (button.over()) {  
      button.setActiveState(true);
      try {
        my_tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() {        
          @Override
            public void onInit(int status) {
            if (status == TextToSpeech.SUCCESS) {
              //int result = my_tts.setLanguage(new Locale(Locale.getDefault().getISO3Language(),Locale.getDefault().getISO3Country()));
              my_tts.setLanguage(new Locale("nl_BE"));
              my_tts.speak(str[buttonID], TextToSpeech.QUEUE_FLUSH, null, null);
            }
          }
        }
        );
      } 
      catch(Exception e) {
        println(e);
      }
      button.setActiveState(false);
      break;
    }
  }
}

public void onPause() {
  if (my_tts !=null) {
    my_tts.stop();
    my_tts.shutdown();
  }
  super.onPause();
}

class SimpleButton {
  //Variables
  float x, y, w, h; //position, width and height of button
  String label;
  boolean activeState=false;
  color fillColour = color(125) ; //grey
  color borderColour = color(0) ; //black  

  //Constructor
  SimpleButton (float _x, float _y, float _w, float _h, String _label) {
    x=_x; 
    y=_y; 
    w=_w; 
    h=_h;
    label=_label ;
  }

  //Methods

  void display() {
    fill(fillColour);
    rect(x, y, w, h);
    fill(0);
    text(label, x, y, w, h);
  }//end

  boolean over() {
    return (mouseX>x && mouseX<x+w && mouseY>y && mouseY<y+h);
  }

  void setActiveState(boolean _state) {
    activeState = _state ;
    if (activeState) {
      fillColour = color(255, 0, 0); //red
    } else {
      fillColour = color(125); //grey
    }
  }
}

I can confirm your findings that in order to export your app from the Processing IDE you are first required to give it a specific name, eg ‘com.johan.myApp’ and then when you do the error message says that you need to add several icons specific to your app. Furthermore, the link to help on the error message screen is broken and the app never does get exported.

(I just want to run my program stand-alone on the phone)

In spite of all the problems above there should still be a standalone app on your Samsung device under ‘Apps’ and it should run as expected when the device is unplugged from the PC. However, this doesn’t help your mother in law unless you want to give her your device. Alternatively as a work around you perhaps could connect the device that she will be using to your PC and run the code. That should put a stand alone app on her phone (or tablet). Wish I had more to offer. I would be interested to know if others are able to successfully export an app from the Processing IDE. I have done it in the past but am no longer able to do it with the current editor (3.5.4).

Hi Svan, thanks for helping me out!! Indeed there is an app created on the connected phone. You just have to scroll through the apps to the end…
My mother in law can keep this phone as long as she wants so that solved my problem.

For a beginner it is very confusing but now I get it (or at least I think). In de IDE you name it eg ‘com.johan.myApp’ (not only the manifest!).
Anyway you made my day!
For those who are in the same situation as I am (with people who cannot verbally communicate) the fine-tuned .pde:

import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import java.util.Locale;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.speech.RecognizerIntent;
import android.content.*; 

ArrayList <SimpleButton> buttonList; 
// List of button labels to be edited according needs 
String[] buttonLabel = {"Ochtend", "Middag", "Avond", "Nacht", "Hallo", "Ja", "Neen", "Goed","Weet niet", "OK", "Gelijk", "Beter", "Pijn", "WC", "Drinken", "Slapen", "Dutje", "Wassen", "Dank u", "U OK?","Gisteren","Vandaag","Morgen","Lea","Marc", "Mieke","Francois","Yvette","Isabel","Lisa","Johan","Komt","Geweest"};
//Corresponding spoken output, same order to be edited according needs
String[] str = {"Goedemorgen", "Goede middag", "Goede avond", "Goede nacht", "Hallo", "Ja", "Neen", "Goed", "Dat weet ik niet", "OK", "Dat is voor mij gelijk", "Ik voel me wat beter", "Pijn", "Ik zou naar de WC willen gaan. Kan u me helpen?", "Ik had graag iets te drinken gekregen", "Ik voel me wat moe, ik zou graag willen slapen", "Ik ga een dutje doen", "Ik zou me graag willen wassen, wil u me helpen?", "Dank u wel", "Hoe gaat het met u?","Gisteren","Vandaag","Morgen","Lea","Mark","Mieke","Fransoea","Yvette","Isabel","Lisa","Johan","Gaat komen","Is geweest"};

TextToSpeech my_tts;
Activity activity;
Context context;

int buttonID;

void setup() {
  fullScreen();
  background(0, 0, 0);
  fill(200);
  int perline = 3; // number of buttons per line
  float buttonWidth = width/perline;
  float buttonHeight = height/int(buttonLabel.length/perline);
  float yPos = 0 ;
  buttonList = new ArrayList<SimpleButton>(); 
  for (int i=0; i<buttonLabel.length; i++) {
    buttonList.add(new SimpleButton((i%perline)*buttonWidth, yPos+int(i/perline)*buttonHeight, buttonWidth, buttonHeight, buttonLabel[i]));
  }
  textSize(40);
  textAlign(CENTER, CENTER);
  for (int i=0; i<buttonLabel.length; i++) {
    SimpleButton button = buttonList.get(i);
    button.display();
  }
  activity = this.getActivity();
  context = activity.getApplicationContext();
}

void draw() {
}

void mousePressed() {
  for (int i=0; i<buttonLabel.length; i++) {
    buttonID = i;
    SimpleButton button =  buttonList.get(buttonID);
    if (button.over()) {  
      button.setActiveState(true);
      try {
        my_tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() {        
          @Override
            public void onInit(int status) {
            if (status == TextToSpeech.SUCCESS) {
              my_tts.setLanguage(new Locale("nl_BE")); // change here to your spoken language; for Dutch fe. you have to purchase a separate app from the app-store
              my_tts.speak(str[buttonID], TextToSpeech.QUEUE_FLUSH, null, null);
            }
          }
        }
        );
      } 
      catch(Exception e) {
        println(e);
      }
      button.setActiveState(false);
      break;
    }
  }
}

public void onPause() {
  if (my_tts !=null) {
    my_tts.stop();
    my_tts.shutdown();
  }
  super.onPause();
}

class SimpleButton {
  float x, y, w, h;
  String label;
  boolean activeState=false;
  color fillColour = color(125) ; //grey
  color borderColour = color(0) ; //black  

  SimpleButton (float _x, float _y, float _w, float _h, String _label) {
    x=_x; 
    y=_y; 
    w=_w; 
    h=_h;
    label=_label ;
  }

  void display() {
    fill(fillColour);
    rect(x, y, w, h);
    fill(0);
    text(label, x, y, w, h);
  }

  boolean over() {
    return (mouseX>x && mouseX<x+w && mouseY>y && mouseY<y+h);
  }

  void setActiveState(boolean _state) {
    activeState = _state ;
    if (activeState) {
      fillColour = color(255, 0, 0); 
    } else {
      fillColour = color(125); 
    }
  }
}

Glad you got it working and thanks for sharing the source code. It’s nice work, particularly for your first effort in Processing, and hopefully your family member will find it useful.