Not working emulator

edited March 2018 in Android Mode

I have problems running a sketch in Emulator (Android Mode) I use Processing 3.3.6 on Windows 10. Android Mode 4.0.1 installed.

  1. when I launch the emulator, I just get a black screen of Android Emulator - processing - phone:5566
  2. After a long wait with "Waiting for the emulator to become available" I get "Lost connection with emulator while launching. Try again".

It seems I have not accepted the license Agreement of the component [Android SDK Build - Tools 26.0.2]

Maybe there is a problem with the folder’s names…

Processing tells:

Checking the license for package Android SDK Build-Tools 26.0.2 in C:\Users\HP\Documents\Processing\android\sdk\licenses

but I have different folders' names (for instance, I have C:\Utenti\ ... that's the Italian for "Users"...

I just want to create very simple apps from simple Processing code. I fear my technical knowledge is … almost null; if you want to help me, you have to explain in detail what I have to do. Suggestions? Thanks a lot!

Tagged:

Answers

  • Can you describe how did you install your android SDK? Also, have you run a sketch before on an actual device? From Processing? Fro AS?

    My first suggestion is to make sure your Android Mode (AM) is correctly setup. Hence, I am asking these questions.

    Kf

  • Thank you so much kfrajer I followed the instruction in

    http://p5android-book.andrescolubri.net/chapter-1/index.html

    __**Open the CM by clicking the “Add Mode…” option that appears in the drop-down menu in the upper-right corner of the PDE (Figure 1-4).

    Figure 1-4. Opening the Contribution Manager to add a new mode Select the entry for Android mode in the Modes tab, then click the Install button. After installation is complete, close the CM and switch to Android mode using the same drop-down menu from Figure 1-4. If a valid SDK is detected on the computer, Processing will ask if we want to use it or download a new one (Figure 1-5). Because the SDK is very large (up to several GBs), it can be a good idea to use the one that is already installed to save disk space. However, if that SDK is also used by another development tool, such as Android Studio, it may get updated outside Processing, which may lead to incompatibilities with the mode._** _ Now, even if I download a more recent release of Processing, Android Mode 4.0.1 is available when I launch Processing for the first time. I removed and re-installed Android Mode: nothing changed.

    I didn't run a sketch on an actual device.

    Here is the path I get on my PC: C:\Utenti\HP\Documents\Processing\android\sdk

    I have no "licenses" folder but

    C:\Users\HP\Documents\Processing\android\sdk\extras C:\Users\HP\Documents\Processing\android\sdk\extras\android\m2repository C:\Users\HP\Documents\Processing\android\sdk\extras\google\m2repository ....

  • edited March 2018

    Ok, thank you for answering the questions. This is how I installed the AM in Processing. I want to document it here and keep in mind these notes are from memory. Just to add, I run the emulator in Processing just now and it worked.

    I have a Win 10 machine and P3.3.6 and AM4.0.1. I installed the Android SDK by installing Android Studio and selecting to install the Android SDK as well. I made a note of the sdk folder selected in the installation. Then I started Android Studio, I go to its SDK manager and I make sure I have Android API 26 (I didn't check this step, but I think I also have 21, 22 and 24). After they are installed, I closed AS. Then I ran Processing, I installed the AM as described above. After AM is installed, I switched from java to Android Mode in the PDE. The first time it tells me it cannot find the Android SDK and it gives me two options: Locate SDK Path Manually or Download SDK Automatically. I chose the first one and I provided the path of my SDK manually.

    Then before I do anything else, I go to Android >> SDK updater and I make sure there are no updates pending.

    Then in the processing IDE, I use the template I provide at the end of this post for testing. Then I go to Sketch>>Run in Emulator. As you described, an emulator window is launched where a Google animation is played for 15 seconds before the screen goes black. After about 2 minutes (ahhh slow laptop) I get the emulator showing me what it looks like a phone: Android Emulator - processing-phine:5566. My sketch is launched there. I click on the window and I register the ellipses.

    As a side note, I cannot comment if downloading the Android SDK automatically works all the time. I tried this method long ago and it didn't work for me. I stick to this manner to install my Android SDK. From what I read, it seems that installing it this option, through the PDE, provides all the files you need to run AM in Processing. The reason I do it through Android Studio is because I am able to select and remove items in the SDK through their program. These options are simply not present in the SDK Updater in Processing.

    Kf

    //===========================================================================
    // IMPORTS:
    
    import android.app.Activity;
    import android.content.Context;
    import android.widget.FrameLayout;
    //import android.app.Fragment;
    
    import android.os.Environment;
    import android.graphics.Color;
    import android.widget.Toast;
    import android.os.Looper;
    import android.view.WindowManager;
    import android.os.Bundle;
    import android.view.ViewParent;
    import android.view.ViewGroup;
    import android.view.View;
    import android.widget.RelativeLayout;
    import android.view.LayoutInflater;
    import android.R.string;
    
    
    //===========================================================================
    // FINAL FIELDS:
    
    
    //===========================================================================
    // GLOBAL VARIABLES:
    
    Activity act;
    Context mC;
    
    //===========================================================================
    // PROCESSING DEFAULT FUNCTIONS:
    
    void setup(){
      //size(400,600);
      fullScreen();
      orientation(PORTRAIT);
      //orientation(LANDSCAPE;)
    
      act = this.getActivity();
      Looper.prepare();
    
      textAlign(CENTER,CENTER);
      rectMode(CENTER);
    
      fill(255);
      strokeWeight(2);
      textSize(32);
    
    
    }
    
    void draw(){
    
      //Erases everything in the sketch every two seconds approx.
      if(frameCount%120==0) 
         background(0);
    
    }
    
    void keyReleased(){
    
    }
    
    void mouseReleased(){
      fill(random(255));
      ellipse(mouseX,mouseY,50,50);
    
    }
    
    
    //===========================================================================
    // OTHER FUNCTIONS:
    
    
    
    //===========================================================================
    // ANDROID ACTIVITY LIFECYCLE'S FUNCTIONS:
    
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
    }
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onStart() {
      super.onStart();
    }
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onResume() {
      super.onResume();
    
      act = this.getActivity();
      mC= act.getApplicationContext();
    
    }
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onPause() {
      super.onPause();
    }
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onStop() {
      super.onStop();
    }
    
    //  @@@@@@@@@@@@
    @ Override 
      public void onDestroy() {
      super.onDestroy();
    }
    

    Keywords: kf_keyword Android_SDK Android_SDK_Install Android_Emulator

  • Thank you so much, kfrajer, you are very kind. I'll try to follow your suggestions and I'll let you know what happens

  • I installed Android Studio; if I run Processing, I have Android Mode 4.0.1 installed (I removed and re-installed several times). When I try to "Run in Emulator" a sketch, well, same problems. Maybe the following images can help you to solve the problem (as I told before, alas, my thecnical knowledges are ... close to zero)

    SDK0

    SDK1

    SDK2

    SDK3

    sdk4

    sdk5

  • It is hard to read but the first few lines of your error says you have to accept a license agreement for Android SDK Tools. Please do a search in google and see if you find any leads.

    Kf

  • Hi oighen. When I started with processing some months ago, l had the same problem. I have spent hours and hours, without success. Running on device works well, but why would you wait 4 minutes to compile on your PC. My advice is; use APDE, It compiles in seconds! But use the beta version. The one on the Play Store has a terrible bug. You lose your code sometimes!

    https://www.dropbox.com/s/aurd10i2rage28u/APDE-bugfix-2017-12-08.apk?dl=0

  • @oighen The emulator is working for me. Anyways, these links are relevant:

    https://stackoverflow.com/questions/39760172/you-have-not-accepted-the-license-agreements-of-the-following-sdk-components
    https://developer.android.com/studio/command-line/sdkmanager.html

    @noel How do you work with the APDE? Do you type your code directly in the app? If you were working in a PC, could you load it directly into the APDE?

    Kf

  • @noel: Thank you, noel. I don't have a smartphone connected to the PC, I don't know if I can use APDE. I share kfrajer question to you.

    @kfrajer: Things are getting better! Thanks! I went to the \sdk\ folder and wrote: ' ./sdk manager "build-tools; 26.0.2" ' as suggested in the first link and ... here is the result:

    miglioramento3

    BUILD SUCCESSFUL and no more "red messages". Now, after some time with "waiting for emulator to become available", I get the "lost connection with emulator while launching. Try again" message. I don't get the "Android emulator Processing Phone" as I did before. Any suggestion?

  • @kfrajer Yes, typing directly into the APDE, exactly the same as in android mode. If it wasn't for APDE I would have stopped in in the first days.To test/run every bit of code you have to wait minutes? BTW I discovered this app only after a few days because it is only mentioned, as the last example of the Processing Android page of what can be done with Processing. Not fair I think. It has to be mentioned on the front page.It's currently a one man's job, he could need some help.

    As for your second question; no, in my PC, Processing Android mode compiles and runs/installs the apk directly. But you have to have an OTG enabled device.

    To open an existing android project I use AIDE (free), you can use the UI Designer (paid) with it to make life easier.

  • @oighen

    Screenshots are really hard to read. You are better off copying and pasting the errors from the console directly here in the forum and use "quoting" formatting to present that data.

    The shutting down the existing server happens after few minutes or right after the successfully building the app? Yes, usually when I ran the sketch in the emulator the first time, it takes about a cpl of min to start. However, after the emulator is running, installing and running the apps there take a bit shorter but not by much. The trick is not to close the emulator... just keep it open.

    I am not an expert in the emulator as I have done most of my testing in my device. Can you remind me what Androip APIs do you have installed in your system?

    @noel @hudson_m4000 @phoebus Does the emulator work for you by any chance?

    Kf

  • @kfrajer I don't have enough room in my HDD to host the emulator images, nor enough RAM to have the thing going anyway :(

  • @Kfrajer Using processor Celeron J1800 2.41 GHz Ram 4 GB windows 10, latest install Never worked! Keeps saying "waiting for emulator to become available", with the emulater ready right in front of me. Then gives error: "lost connection with emulator while launching".

  • Tagging @codeanticode Maybe Andres has some suggestions.

    Thxs @noel and @phoebus for your input.

    Kf

  • @kfrajer I stopped trying to use the emulators years ago ... they did kind of work but SO SLOW! Much better just using real devices.

  • @kfrajer:"The shutting down the existing server happens after few minutes or right after the successfully building the app?"

    It's a couple of minutes later. I tried again and again; this time I got the "Android Emulator-processing phone:5566" with a completely black screen

  • Do you get a Google (aniamted) screen at all when starting? Do you have a side menu bar attached to the black screen?

    Kf

  • No, no animation at all, just a black screen. Yes, there is the side menu (Power, VolumeUp, VolumeDown, Rotate, ... + Extended Controls)

  • Did you hit the power icon on that side menu? Just hit it once and wait few seconds. Do that only after the emulator loads (give few few minutes to be safe). If that doesn't work... then I will suggest you open a ticket in Processing Android github if you haven't done so.

    Kf

  • Thank you so much kfrajer, I tried to hit the power icon ... no success. The rotate control works. If I go to the Extended controls...

    and I choose "Bug Report" I get:

    mig6

    Clicking "processing-phone" in the previous image, I get:

    mig5

    Choosing "Settings", I get ...

    mig7

    I think I'm going to give up...

  • Sometimes, when I get the "Lost connection with emulator while launching it. Try again" message, (and I tried again and again and again...) this message comes up:

    bugreport

    Any further suggestion? A big THANK YOU for your help and your patience.

  • Here what I get from Android Virtual Device Manager in Android Studio:

    Name: processing_phone

    CPU/ABI: ARM (armeabi-v7a)

    Path: C:\Users\HP\Documents\Processing\android\avd\processing-phone

    Target: default [Default] (API level 24)

    Skin: 480x800

    SD Card: 64M

    hw.dPad: no

    hw.lcd.height: 800

    hw.accelerometer: yes

    hw.device.name: Nexus One

    hw.device.manufacturer: Google

    hw.lcd.width: 480

    hw.gps: yes

    image.androidVersion.api: 24

    hw.audioInput: yes

    image.sysdir.1: system-images\android-24\default\armeabi-v7a\

    hw.cpu.model: cortex-a8

    tag.id: default

    hw.mainKeys: yes

    hw.lcd.density: 240

    hw.device.hash2: MD5:0250c2773d1dd25bb2b12d9502c789f7

    hw.trackBall: yes

    PlayStore.enabled: false

    hw.battery: yes

    hw.sdCard: yes

    tag.display: Default

    hw.sensors.proximity: yes

    hw.sensors.orientation: no

    avd.ini.encoding: UTF-8

  • @oighen===

    there can be a lot of reasons for your problem::

    -hardware: you have not enough ram to run the emulator or diskspace for it; some emulators need 4GB and 4GB RAM is the min required on your computer.

    • system images: i see that you are using arm, Intel x86 is much faster

    • what is your CPU???

    • if intel you can (probably, verify that point on the Intel site)) use HAXM; be sure that it is installed (you have to launch the .exe in your sdk extras folder); be sure also that Intel(r) VT-x is enabled in the Bios

    • i see you can use AS; so with AS, when creating your virtual device go to "advanced settings" and here change (if needed) "automatic" to software GLES

    • last point to check is the "cold boot"; if you have not VT_X check it

    • Anyway at launch the emulator is very slow without HAXM and with Cold boot (which means like restarting with the power button some real phone); it takes 3 or 4 '

  • Thank you so much akenaton. As I wrote before, my technical knowledge is, well, ... close to zero. Anyway, if I use AS and launch AVD Manager I get the "Your CPU does not support required features (VT-x or SVM)" message. The "Troubleshoot Window" suggests to use an AVD based on ARM system Image:

    a1

    In the "Your Virtual Devices" window, the one named "processing phone" is "arm" (Resolution 480x800 hdpi; API 24; Target: Android 7.0; CPU/ABI: arm; Size on Disk: 1GB). System Image: armeabi-v7a)

    I downloaded SIW to check my PC; here some information:

    Memory: Type: DDR3; installed:4096.0 MB; Available: 3538.0 MB Virtual memory: 5074 MB; 1394 MB free.

    CPU: AMD E1-2100 APU with Radeon HD Graphics Frequency CPU: 1000 MHz; System Frequency: 99.8 MHz:

    Motherboard: Hewlett Packard 21F7

    O.S. Windows 10 H0mex64, Version 1709

  • @oighen===

    ok; the error message is what i was afraid of...your CPU is not INTEL && so HAXM is not allowed; that means that even if your RAM was ok (it is quite but not really!) the emulator (with armeabi) will run 5 or 6 times slower than with HAXM and allows only "cold boot": i have tried with this config (and 8GB RAM) in order to verify, choosing systemImage for 4.4: the emulator (the last one, 27+) started after 30'!!!! So: you only can buy a new computer...or use a real device...or (for testing with AS) use firebase...Sorry!

  • A big THANK YOU, Akenaton. I got the picture of the situation. I think I'll get a real device for my tiny and shy experiments witn Processing for Android.

  • Answer ✓

    @oighen=== that is the best choice though if you really want to work with android you must get 3 or 4 devices; yet firebase is a solution (with AS). and put answered for others (they are a lot...)

Sign In or Register to comment.