"Could not create a virtual device for the emulator".

edited October 2015 in Android Mode

I just did a fresh (today) install of Processing 3.0 (latest download available from processing.org), and installed the Android SDK - Android 6.0 (API 23) and Android 2.3.3 (API 10).

In older versions of Processing for Android which I happily used for a long time, a virtual device was (eventually) created automatically when you ran the emulator the first time. This seems to not happen anymore. Now, if I start with no virtual device, or matter what device profile I do create in the AVD Manager, whenever I try to run a sketch in the emulator, even when I manually start it, I get "Could not create a virtual device for the emulator". Anyone else getting this error? Anyone have a solution?

I read on the old forum that deleting Intel Atom x86 System Image can work, but it didn't.

I am running Windows 7 64-bit. Java version 8 update 60.

Answers

  • @PDF:: i am not sure about it but i think that for 3.0 it compiles with API 17

  • @akenaton - I am testing this now, and will let you know how I get on.

  • Thank you for the input, but sadly installing API 17 does not solve the problem. Manually creating a virtual device, and launching manually does not work. Running the sketch straight from Processing without starting the emulator does not work... Same "Could not create a virtual device for the emulator" with no specific error in the console.

    Changing the target SDK makes no difference either. I assume people have got the Android version to work in P3?

    This is a shame because P3 seems to be compiling/building much faster than previous versions of Processing.

  • I read on another forum post - sorry to the author, I cannot remember who - maybe you @akenaton that installing API 11 works. Here goes...

    ...Interesting, installing and targeting API 11 almost worked. I received a "installing on emulator", but then it failed with the following error:

    Lost connection with device while installing. Try again.

    Failure [INSTALL_FAILED_OLDER_SDK] Shutting down any existing adb server...

  • @PDF197== yes, it was me, now i remember... try also to delete the manifest, if i do remember there is a problem with it and changing the target changes nothing for compiling: see the console, API 17 is hardcoded by processing...

  • I'm pretty sure the new minimum API is 15

  • @hudson_m4000 && PDF197:: without seeing the manifest it s difficult to answer; with android when you dont set a minSdk, default is 1; so the best way to try is to set minSDK to 8,9,10 and so on, seeing what happens. As i dont work with processing for android i cannot remind exactly how i have done when installing && testing (my emulator runs well). Yet i am sure that minSDK was one of the problems, (others in preferences.txt where you can see if the emulator is present and for what port).

  • For 2.x API10 had to be installed and from my undstanding (from comments in wiki and on github by BenFry), 3.x requires 15, others too if you like, but you must have 15.

  • edited October 2015

    @hudson_m400

    the API which MUST be installed is the API used by P5 for pre-compil:: for 2X it is 10; for P3XX it is 17.

    this is the "target==SDK" which means the target you assume (and tested!!!) your app will work with it.

    Now there is also the minTargetSDK. If you don't specify it in the Manifest minSdk will be (default) set to API1 and it is possible (probable) that your app will not work fine on real devices and emulators: depends of the methods you use and (for the emulator) of how it is designed.

    See here::

    developer.android.com/guide/topics/manifest/uses-sdk-element.html

    I dont remember now and have to verify what are the choices for the processing default emulator. Perhaps min is set to 15: in this case Koogs is right for THIS emulator; but, i think, you can perfectly create another one with other choices...The only thing you cannot change is the targetSDK: 17; try to put more and look to the messages in the console: the value is always "resolved" to 17 (in 2XX it was 10 ).

    Of course if you choose 15, 14 or what you want , you have to get installed these APIS in your AVD:: verify that and choose to add or update.

    If processing could only run with min 15 it would be agains all android principles (trying to find ways for making apps build with new APIS compatible with old os, which is a great challenge). That s why (for example) android has created the appCompat v4 or v7...

  • edited October 2015

    @akenaton this is not what the developers say on github, they say it's API 15

    I don't even have API 17 installed and I have no problems with deploying my app on any platform from 4.0.3 onwards (API 15 in AVD manager). I haven't used emulators, just real phones and tablets.

    A quick test... set target API to15 and look at the manifest in the sketch folder:

       uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15"
    

    Now.. if I select my target as API 21, for example (in Processing), the app will only run on 5.0.1(my phone) and upwards, and not on on 4.0.3 (my tablet), but if you set the min and target sdk to the same level, as I have done, it will work on all android versions from 4.0.3 onwards.

    With 2.x I never even thought about it, as I think the Android Mode did this automatically (using API 10) in the background. Everything I did ran fine on all devices I ever tried from 2.3.3 onwards. It's only now with 3.0 that this issue has arisen.

    And if you want to deploy on 2.3.3 etc then you can't use Processing 3.x, you must stick with 2.x

  • @hudson_m400::

    i read here:: https://github.com/processing/processing-android/wiki

    that== "(now:: july 2015...) We're only supporting Android 3.0.x (API 11) and later...." - Before it was 10. So, now minSDK can be 11 (not older). Of course, 15 will work as 17 is the hardcoded targetSDK. Look to your console when it compiles.

  • re the wiki saying API 11 I think that is just very out of date ( and wrong?!)

    I will look at my console ....

  • edited October 2015

    OK, my console output.. no mention of API 17, just 15 ?

        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin
         [echo] org.eclipse.jdt.core.JDTCompilerAdapter
    
    -set-mode-check:
    
    -set-debug-files:
    
    -check-env:
    Android SDK Tools Revision 24.3.4
    Installed at C:\Users\Mark\Documents\Processing\modes\AndroidMode\sdk
    
    -setup:
         [echo] Project Name: sdkTest
    Project Type: Application
    
    -set-debug-mode:
    
    -debug-obfuscation-check:
    
    -pre-build:
    
    -build-setup:
    Using latest Build Tools: 20.0.0
         [echo] Resolving Build Target for sdkTest...
    Project Target:   Android 4.0.3
    API level:        15
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\res
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\rsObj
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\rsLibs
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\gen
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\classes
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\dexedLibs
         [echo] ----------
         [echo] Resolving Dependencies for sdkTest...
    Library dependencies:
    No Libraries
    
    ------------------
    API<=15: Adding annotations.jar to the classpath.
         [echo] ----------
         [echo] Building Libraries with 'debug'...
       [subant] No sub-builds to iterate on
    
    -code-gen:
    Merging AndroidManifest files into one.
    Manifest merger disabled. Using project manifest only.
         [echo] Handling aidl files...
    No AIDL files to compile.
         [echo] ----------
         [echo] Handling RenderScript files...
         [echo] ----------
         [echo] Handling Resources...
    Generating resource IDs...
         [echo] ----------
         [echo] Handling BuildConfig class...
    Generating BuildConfig class.
    
    -pre-compile:
    
    -compile:
        [javac] Compiling 4 source files to C:\Users\Mark\AppData\Local\Temp\android5512481963804587503sketch\bin\classes
    
  • edited October 2015

    and in your manifest what was the TargetSdk??? - 15, i bet! - put 19 and see...

    another question = what version of processing 3??? to morrow (sunday!) i ll get sometime to verify all these points with processing and post results.

  • edited October 2015

    Ok, I don't have19 installed so this is with 21set as target. Using 3.0 release version

    Manifest:

    uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"

    Console:

        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin
         [echo] org.eclipse.jdt.core.JDTCompilerAdapter
    
    -set-mode-check:
    
    -set-debug-files:
    
    -check-env:
    Android SDK Tools Revision 24.3.4
    Installed at C:\Users\Mark\Documents\Processing\modes\AndroidMode\sdk
    
    -setup:
         [echo] Project Name: sdkTest
    Project Type: Application
    
    -set-debug-mode:
    
    -debug-obfuscation-check:
    
    -pre-build:
    
    -build-setup:
    Using latest Build Tools: 20.0.0
         [echo] Resolving Build Target for sdkTest...
    Project Target:   Android 5.0.1
    API level:        21
         [echo] ----------
         [echo] Creating output directories if needed...
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\res
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\rsObj
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\rsLibs
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\gen
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\classes
        [mkdir] Created dir: C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\dexedLibs
         [echo] ----------
         [echo] Resolving Dependencies for sdkTest...
    Library dependencies:
    No Libraries
    
    ------------------
         [echo] ----------
         [echo] Building Libraries with 'debug'...
       [subant] No sub-builds to iterate on
    
    -code-gen:
    Merging AndroidManifest files into one.
    Manifest merger disabled. Using project manifest only.
         [echo] Handling aidl files...
    No AIDL files to compile.
         [echo] ----------
         [echo] Handling RenderScript files...
         [echo] ----------
         [echo] Handling Resources...
    Generating resource IDs...
         [echo] ----------
         [echo] Handling BuildConfig class...
    Generating BuildConfig class.
    
    -pre-compile:
    
    -compile:
        [javac] Compiling 4 source files to C:\Users\Mark\AppData\Local\Temp\android5565503660750496577sketch\bin\classes
    
  • @hudson_m4000::

    P3 tested with this manifest::

        <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
                  package="" 
                  android:versionCode="1" 
                  android:versionName="1.0">
          <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="21"/>
          <application android:label=""
                       android:icon="@drawable/icon"
                       android:debuggable="true">
            <activity android:name=".MainActivity">
                      android:theme="@android:style/Theme.NoTitleBar">
              <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
            </activity>
          </application>
        </manifest>
    

    it runs (on an emulator i have created, API 21)

  • edited October 2015

    @hudson_m4000:: i think i have understood...

    a) i suppose that first time you install and open the android mode in processing only 15 && 17 levels are present in the menu "select target SDK"

    b) each time you update the SDK (level 16,17....) these new levels are added in the processing menu

    c) levels <15 are NEVER present in this menu, though installed in the SDK

    d) this menu defines the targetSDK EVEN if you write (i have tested) targetSDK = 12 or... in the manifest; so i don't understand why they talk about 11 in the link i have posted yesterday!

    e) minSdk seems, as for android, left to your responsability OR resetted to 15 by processing in any case: till now i don't know. In order to be sure, if i have time for that, i ll try setting minSDK to 8, writing code which cannot run with this "old" API and see if an error is fired building the app.

  • @akenaton I assume you had to edit the manifest to set minSdk to 11? By default it is always 15 for me with P3.

    Still not sure about the 17 .... I don't see that anywhere and never have?!

    I think Processing's aim of Android Mode being 'trivially easy' to use has kind of lost it's way a bit with P3. With P2 the manifest never had any specified targetSdk, only a minSdk set at 10 (and I don't recall P2 having the menu "select target SDK"), which is why I have never had any issues with forward compatibilty on higher level platforms, I guess.

  • @hudson_m400:: yes, i have edited it with Xcode... 17 is only (i think) at the beginning, when you install the android mode; after that it changes, according to your choice in the select target menu (which was not present before P3) and i think that this menu "invalidates" the choice you make in the Manifest for targetSDK....Now, as i posted, i would understand what happens with backward compat without minSDK....

  • @akenaton OK, that makes sense now, and yes using the select target menu sets the targetSdk in the manifest (and also in the prefereneces.txt file) .

    Phew... we can all now go back to just writing our apps :)

  • @hudson_m4000//

    "processing made incredibly easy to write code for android" i think here threre is a typo its not processing, it s eclipse!!!

  • @akenaton :)

    With 2.x it really was easy and once set up in P3 it is again.

    Thanks for all the investigating you have done...

  • @akenaton @hudson_m4000 - Thanks guys. I am away for the weekend and come back and a debate has been raging. I will have a thorough read through of your conversation, and hopefully get a definitive answer to my question. I will of course, post the outcome here.

  • Huge thanks to @akenaton and @hudson_m4000 You have spent a lot of time investigating this but...

    I must be completely stupid, because I cannot follow this at all. I have installed SDKs 10, 11, 15, 17, 21, and 23, and tried to run a very simple example sketch on an emulator without success. I have set the target SDK as each of these, checked the manifest (which by default seems to be 15 in my case), and still had no success.

    The latest problem is that I cannot even create an AVD; the OK button stays greyed-out no matter which options I fill/don't fill.

    I must be doing something wrong. What id your current, successful set-up?

    Is my Java version the problem? I am running the latest version available: 8 update 60.

    This is very frustrating. I had been hoping Processing 3.0 + Android would be seamless, but it seems to have got more complex :(

  • edited October 2015

    <?xml version="1.0"?> -<manifest package="" android:versionName="1.0" android:versionCode="1" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:targetSdkVersion="15" android:minSdkVersion="15"/> -<application android:label="" android:icon="@drawable/icon" android:debuggable="true"> -<activity android:name=".MainActivity"> android:theme="@android:style/Theme.NoTitleBar"> -<intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest>

    This is the latest manifest. The "-" are there in the manifest, the format looks different, and some content is missing. Weird.

  • Sounds as if you are doing similar to me except I just use real phones and tablets. I have just tried setting up an AVD but also get a greyed out ok button.

  • @PDF197:: now (for this date!) --- P3 runs (on my computers) ---&& i have 4 emulators running... ----So : it s not impossible, be happy! ---seriously: ---any error code??? --- have you seen in your preferences txt wether your SDK path and the emulator port are ok??

  • Hi, a litte hint of mine. I am running processing on windows. I downloaded the intel emulator files and the ham driver. But I must manually install the intelhaxm-android.exe to run my emulator. Is in folder ...\modes\AndroidMode\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\ in your processing 3 sketches folder.

    AVD creation works to without this setup, but result in error loading when starting the AVD.

    hope it helps ks

  • @klsc==== HAXM is not at all mandatory to get an emulator running...

  • may be. but there was no hint within the great "all automated installation" from processing 3.0 that I must manually setup this (if I want to use it) and I think here is a place to post. sorry

  • @klsc:: P3 is not easy to install and very very much tricky to use (for non trivial things) - so don't post to talk about non relative questions

  • Thanks for all the input guys especially @akenaton and @hudson_m4000. I have been away from Processing for a month or so, but will go back through this thread, and report any developments from my end.

  • edited December 2015

    Thanks for all the work especially @akenaton and @hudson_m4000. I have been trying to get the emulator to work for weeks, and no matter what I do can't get it to. So, I am no longer using the emulator, and just compile straight on to a device. That always works, and compiles very quickly. In short - spend your time coding not fighting with the emulator.

  • Good plan!

Sign In or Register to comment.