Emulator in Android mode does not work

edited February 2014 in Android Mode

When using the android mode and deploying onto the device directly everything works fine. However, whenever I try to use the emulator, I get the following exception.

Any suggestions might help.

Thanks in advance.

Exception in thread "Thread-31" java.lang.NoSuchMethodError: processing.app.Base.showWarningTiered(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
        at processing.mode.android.AVD.create(AVD.java:162)
        at processing.mode.android.AVD.ensureProperAVD(AVD.java:185)
        at processing.mode.android.AndroidMode.handleRunEmulator(AndroidMode.java:187)
        at processing.mode.android.AndroidEditor$13.run(AndroidEditor.java:288)

Answers

  • edited February 2014

    I've found using the emulator to be marginal at best. Using a hardware device is entirely superior for both compatibility and performance. If it runs on a hardware device I'd say, be happy. This error is most likely a class definition incompatibility issue and can be hard to track down.

  • You are right with your comment. However I am a teacher and trying to make a project out of processing and Android. Pupils without a device should be able to use an emulator if they don't own a device by themselves.

    Do you know what kind of missing class that could be?

  • Looking into the source code the problem seems to emerge from the following line of code

    https://github.com/processing/processing-android/blob/master/src/processing/mode/android/AVD.java#L133

    protected boolean create(final AndroidSDK sdk) throws IOException {
        final String[] params = {
          sdk.getAndroidToolPath(),
          "create", "avd",
          "-n", name,
          "-t", target,
          "-c", DEFAULT_SDCARD_SIZE,
          "-s", DEFAULT_SKIN
        };
    
        // Set the list to null so that exists() will check again
        avdList = null;
    
        final ProcessHelper p = new ProcessHelper(params);
        try {
          // Passes 'no' to "Do you wish to create a custom hardware profile [no]"
    // System.out.println("CREATE AVD STARTING");
          final ProcessResult createAvdResult = p.execute("no");
    // System.out.println("CREATE AVD HAS COMPLETED");
          if (createAvdResult.succeeded()) {
            return true;
          }
          if (createAvdResult.toString().contains("Target id is not valid")) {
            // They didn't install the Google APIs
            Base.showWarningTiered("Android Error", AVD_TARGET_PRIMARY, AVD_TARGET_SECONDARY, null);
    // throw new IOException("Missing required SDK components");
          } else {
            // Just generally not working
    // Base.showWarning("Android Error", AVD_CREATE_ERROR, null);
            Base.showWarningTiered("Android Error", AVD_CREATE_PRIMARY, AVD_CREATE_SECONDARY, null);
            System.out.println(createAvdResult);
    // throw new IOException("Error creating the AVD");
          }
          //System.err.println(createAvdResult);
        } catch (final InterruptedException ie) { }
    
        return false;
      }
    

    Maybe the target id is not correct.

  • Some more investigation showed that an AVD named Processing-0217 must be present. I created one with the following line.

    ./android create avd -n Processing-0217 -t android-10 -c 64M -s WVGA800 --abi x86

    Now everything works fine. :)

  • Glad to see you found the problem. :) It never occurred to me that your install didn't create the required AVD profile for you. I'll have to put this one in my notebook so I'll remember. Cheers.

  • edited May 2014

    Great, I had the same problem.

    I created the machine from the visual editor: Android > Android AVD Manager. This opens the Android Visual Device Manager.

    Settings (I guessed what the command line items signified):

    Screen Shot  2014-05-28 at 14.47.24

  • edited May 2014

    mmm, image upload seems broken...

  • edited May 2014

    @kasperkamperman: I think it the image issue has to do with the auto-link-ifier (based on the page source). I was unable to edit your comment to produce an image, but it looks like I can post it here:

    Screen Shot  2014-05-28 at 14.47.24

Sign In or Register to comment.