Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37982

Android Emulator plugin fails to create AVD for 'android-24' target

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Not A Defect
    • Labels:
      None
    • Environment:
      Jenkins-2.22
      Android Emulator Plugin 2.15
    • Similar Issues:

      Description

      Emulator plugin fails to translate API=24 into 'android-24' target and thus fails to create new AVD:

      [android] The configured Android platform needs to be installed: 24
      [android] Using Android SDK: /var/lib/jenkins/tools/android-sdk/
      [android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_24.avd
      [android] /var/lib/jenkins/tools/android-sdk//tools/android create avd -f -a -s HVGA -n hudson_ru-RU_160_HVGA_24 -t 24
      [android] Failed to run AVD creation command
      	Error: Target id is not valid. Use 'android list targets' to get the target ids.
      	
      [android] Could not create Android emulator: Failed to run AVD creation command
      

      The root cause seems to be inside "Constants.java" - there no any mentions about 7.0 Nougat fresh release

      As I can see, new AndroidPlatform variable should be added to vars and to the "AndroidPlatform[] ALL" list

          static final AndroidPlatform SDK_7_0 = new AndroidPlatform("7.0", 24);
      

        Attachments

          Activity

          Hide
          orrc Christopher Orr added a comment -

          "24" is not a valid Android platform target name.

          As the inline documentation for the OS version field says:

          Can be an OS version, target name or SDK add-on, e.g. "2.1" or "android-7"

          So even although the plugin itself doesn't yet know that "7.0" is equivalent to the target name "android-24", you can still enter "android-24" and it will work fine.

          Show
          orrc Christopher Orr added a comment - "24" is not a valid Android platform target name. As the inline documentation for the OS version field says: Can be an OS version, target name or SDK add-on, e.g. "2.1" or "android-7" So even although the plugin itself doesn't yet know that "7.0" is equivalent to the target name "android-24", you can still enter "android-24" and it will work fine.
          Hide
          kaa Andrey Kopeyko added a comment -

          I faced the problem while using Multi-configuration project and specifying API as one of the axis:

          When I specify API as list of numbers "15 19 21 23" and it works fine - AVDs are created and fired up.

          Next I tried to extend API levels to test and tried API axis as "15 19 21 23 24" - it fails, the message was reproduced in this issue initial. As I can see, it fails because plugin can't convert API level requested into SDK target to operate with.

          When I have modified API axis to "15 19 21 23 androis-24" - plugin have successfully created AVDs.

          IMHO it is rather strange to write "API level" for some versions and "SDK target" for other... Please fix it.

          Show
          kaa Andrey Kopeyko added a comment - I faced the problem while using Multi-configuration project and specifying API as one of the axis: When I specify API as list of numbers "15 19 21 23" and it works fine - AVDs are created and fired up. Next I tried to extend API levels to test and tried API axis as "15 19 21 23 24" - it fails, the message was reproduced in this issue initial. As I can see, it fails because plugin can't convert API level requested into SDK target to operate with. When I have modified API axis to "15 19 21 23 androis-24" - plugin have successfully created AVDs. IMHO it is rather strange to write "API level" for some versions and "SDK target" for other... Please fix it.
          Hide
          kaa Andrey Kopeyko added a comment -

          I've added more explanations in comment

          Show
          kaa Andrey Kopeyko added a comment - I've added more explanations in comment
          Hide
          orrc Christopher Orr added a comment -

          When I specify API as list of numbers "15 19 21 23" and it works fine - AVDs are created and fired up.

          Again, you're using the plugin wrong — as shown in the error message "Error: Target id is not valid. Use 'android list targets' to get the target ids" — you are creating AVDs using random target IDs from android list targets — you are not actually creating AVDs with API levels 15, 19, 21 etc.

          Use the plugin as shown in the documentation (and in my comment above). Change your "OS version" field to be android-${API}, and it will work as you expect.

          Show
          orrc Christopher Orr added a comment - When I specify API as list of numbers "15 19 21 23" and it works fine - AVDs are created and fired up. Again, you're using the plugin wrong — as shown in the error message "Error: Target id is not valid. Use 'android list targets' to get the target ids" — you are creating AVDs using random target IDs from android list targets — you are not actually creating AVDs with API levels 15, 19, 21 etc. Use the plugin as shown in the documentation (and in my comment above). Change your "OS version" field to be android-${API }, and it will work as you expect.
          Hide
          kaa Andrey Kopeyko added a comment -

          @Christopher Orr , you are not right saying

          you are creating AVDs using random target IDs

          As you can see, all AVDs are created with correct targets:

          jenkins@AGnb:~$ tools/android-sdk/tools/android list avds
          Available Android Virtual Devices:
              Name: hudson_en-US_160_HVGA_android-15_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-15_x86.avd
            Target: Android 4.0.3 (API level 15)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_en-US_160_HVGA_android-16_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-16_x86.avd
            Target: Android 4.1.2 (API level 16)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_en-US_160_HVGA_android-19_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-19_x86.avd
            Target: Android 4.4.2 (API level 19)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_en-US_160_HVGA_android-21_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-21_x86.avd
            Target: Android 5.0.1 (API level 21)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_en-US_160_HVGA_android-22_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-22_x86.avd
            Target: Android 5.1.1 (API level 22)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_en-US_160_HVGA_android-23_x86
              Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-23_x86.avd
            Target: Android 6.0 (API level 23)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-15_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-15_x86.avd
            Target: Android 4.0.3 (API level 15)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-16_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-16_x86.avd
            Target: Android 4.1.2 (API level 16)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-19_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-19_x86.avd
            Target: Android 4.4.2 (API level 19)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-21_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-21_x86.avd
            Target: Android 5.0.1 (API level 21)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-22_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-22_x86.avd
            Target: Android 5.1.1 (API level 22)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-23_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-23_x86.avd
            Target: Android 6.0 (API level 23)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_ru-RU_160_HVGA_android-24_x86
              Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-24_x86.avd
            Target: Android 7.0 (API level 24)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-15_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-15_x86.avd
            Target: Android 4.0.3 (API level 15)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-16_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-16_x86.avd
            Target: Android 4.1.2 (API level 16)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-19_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-19_x86.avd
            Target: Android 4.4.2 (API level 19)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-21_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-21_x86.avd
            Target: Android 5.0.1 (API level 21)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-22_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-22_x86.avd
            Target: Android 5.1.1 (API level 22)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-23_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-23_x86.avd
            Target: Android 6.0 (API level 23)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          ---------
              Name: hudson_vi-VN_160_HVGA_android-24_x86
              Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-24_x86.avd
            Target: Android 7.0 (API level 24)
           Tag/ABI: default/x86
              Skin: hvga
          Snapshot: true
          jenkins@AGnb:~$ 
          

          Thank you for {{android-${API} }} advise, I'll try it today later.

          Must this trick be mentioned in the plugin wiki page?

          Show
          kaa Andrey Kopeyko added a comment - @Christopher Orr , you are not right saying you are creating AVDs using random target IDs As you can see, all AVDs are created with correct targets: jenkins@AGnb:~$ tools/android-sdk/tools/android list avds Available Android Virtual Devices: Name: hudson_en-US_160_HVGA_android-15_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-15_x86.avd Target: Android 4.0.3 (API level 15) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_en-US_160_HVGA_android-16_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-16_x86.avd Target: Android 4.1.2 (API level 16) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_en-US_160_HVGA_android-19_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-19_x86.avd Target: Android 4.4.2 (API level 19) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_en-US_160_HVGA_android-21_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-21_x86.avd Target: Android 5.0.1 (API level 21) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_en-US_160_HVGA_android-22_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-22_x86.avd Target: Android 5.1.1 (API level 22) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_en-US_160_HVGA_android-23_x86 Path: /var/lib/jenkins/.android/avd/hudson_en-US_160_HVGA_android-23_x86.avd Target: Android 6.0 (API level 23) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-15_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-15_x86.avd Target: Android 4.0.3 (API level 15) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-16_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-16_x86.avd Target: Android 4.1.2 (API level 16) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-19_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-19_x86.avd Target: Android 4.4.2 (API level 19) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-21_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-21_x86.avd Target: Android 5.0.1 (API level 21) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-22_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-22_x86.avd Target: Android 5.1.1 (API level 22) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-23_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-23_x86.avd Target: Android 6.0 (API level 23) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_ru-RU_160_HVGA_android-24_x86 Path: /var/lib/jenkins/.android/avd/hudson_ru-RU_160_HVGA_android-24_x86.avd Target: Android 7.0 (API level 24) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-15_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-15_x86.avd Target: Android 4.0.3 (API level 15) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-16_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-16_x86.avd Target: Android 4.1.2 (API level 16) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-19_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-19_x86.avd Target: Android 4.4.2 (API level 19) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-21_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-21_x86.avd Target: Android 5.0.1 (API level 21) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-22_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-22_x86.avd Target: Android 5.1.1 (API level 22) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-23_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-23_x86.avd Target: Android 6.0 (API level 23) Tag/ABI: default/x86 Skin: hvga Snapshot: true --------- Name: hudson_vi-VN_160_HVGA_android-24_x86 Path: /var/lib/jenkins/.android/avd/hudson_vi-VN_160_HVGA_android-24_x86.avd Target: Android 7.0 (API level 24) Tag/ABI: default/x86 Skin: hvga Snapshot: true jenkins@AGnb:~$ Thank you for {{android-${API} }} advise, I'll try it today later. Must this trick be mentioned in the plugin wiki page?

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              kaa Andrey Kopeyko
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: