Failed to use android command to create AVD after build Android 8.1.0









up vote
0
down vote

favorite












After successfully building Android 8.1.0, I try to create an AVD use the "android" command. But it failed with Java exception.



$ android -list targets



Exception in thread "main" java.lang.NoClassDefFoundError: com/android/sdklib/repository/SdkRepoConstants
at com.android.sdkmanager.SdkCommandLine.<init>(SdkCommandLine.java:340)
at com.android.sdkmanager.Main.init(Main.java:222)
at com.android.sdkmanager.Main.run(Main.java:148)
at com.android.sdkmanager.Main.main(Main.java:117)
Caused by: java.lang.ClassNotFoundException: com.android.sdklib.repository.SdkRepoConstants
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more


How can I fix it?
Thanks a lot!



Env.
1. OS
Ubuntu 18.04.1 LTS



  1. Java version
    openjdk version "1.8.0_181"
    OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
    OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)


  2. Android source code
    ./repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.1.0_r46


  3. Operations
    $ source build/envsetup.sh
    $ lunch aosp_arm-eng
    Build Android source code successfully!



  4. PATH



    /usr/lib/jvm/java-8-openjdk-amd64/bin:/dev/android/out/soong/host/linux-x86/bin:/dev/android/out/host/linux-x86/bin:/dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:/dev/android/development/scripts:/dev/android/prebuilts/devtools/tools:/dev/android/external/selinux/prebuilts/bin:/dev/android/prebuilts/misc/linux-x86/dtc:/dev/android/prebuilts/misc/linux-x86/libufdt:/dev/android/prebuilts/android-emulator/linux-x86_64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin











share|improve this question

























    up vote
    0
    down vote

    favorite












    After successfully building Android 8.1.0, I try to create an AVD use the "android" command. But it failed with Java exception.



    $ android -list targets



    Exception in thread "main" java.lang.NoClassDefFoundError: com/android/sdklib/repository/SdkRepoConstants
    at com.android.sdkmanager.SdkCommandLine.<init>(SdkCommandLine.java:340)
    at com.android.sdkmanager.Main.init(Main.java:222)
    at com.android.sdkmanager.Main.run(Main.java:148)
    at com.android.sdkmanager.Main.main(Main.java:117)
    Caused by: java.lang.ClassNotFoundException: com.android.sdklib.repository.SdkRepoConstants
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more


    How can I fix it?
    Thanks a lot!



    Env.
    1. OS
    Ubuntu 18.04.1 LTS



    1. Java version
      openjdk version "1.8.0_181"
      OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
      OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)


    2. Android source code
      ./repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.1.0_r46


    3. Operations
      $ source build/envsetup.sh
      $ lunch aosp_arm-eng
      Build Android source code successfully!



    4. PATH



      /usr/lib/jvm/java-8-openjdk-amd64/bin:/dev/android/out/soong/host/linux-x86/bin:/dev/android/out/host/linux-x86/bin:/dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:/dev/android/development/scripts:/dev/android/prebuilts/devtools/tools:/dev/android/external/selinux/prebuilts/bin:/dev/android/prebuilts/misc/linux-x86/dtc:/dev/android/prebuilts/misc/linux-x86/libufdt:/dev/android/prebuilts/android-emulator/linux-x86_64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin











    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      After successfully building Android 8.1.0, I try to create an AVD use the "android" command. But it failed with Java exception.



      $ android -list targets



      Exception in thread "main" java.lang.NoClassDefFoundError: com/android/sdklib/repository/SdkRepoConstants
      at com.android.sdkmanager.SdkCommandLine.<init>(SdkCommandLine.java:340)
      at com.android.sdkmanager.Main.init(Main.java:222)
      at com.android.sdkmanager.Main.run(Main.java:148)
      at com.android.sdkmanager.Main.main(Main.java:117)
      Caused by: java.lang.ClassNotFoundException: com.android.sdklib.repository.SdkRepoConstants
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 4 more


      How can I fix it?
      Thanks a lot!



      Env.
      1. OS
      Ubuntu 18.04.1 LTS



      1. Java version
        openjdk version "1.8.0_181"
        OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
        OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)


      2. Android source code
        ./repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.1.0_r46


      3. Operations
        $ source build/envsetup.sh
        $ lunch aosp_arm-eng
        Build Android source code successfully!



      4. PATH



        /usr/lib/jvm/java-8-openjdk-amd64/bin:/dev/android/out/soong/host/linux-x86/bin:/dev/android/out/host/linux-x86/bin:/dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:/dev/android/development/scripts:/dev/android/prebuilts/devtools/tools:/dev/android/external/selinux/prebuilts/bin:/dev/android/prebuilts/misc/linux-x86/dtc:/dev/android/prebuilts/misc/linux-x86/libufdt:/dev/android/prebuilts/android-emulator/linux-x86_64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin











      share|improve this question













      After successfully building Android 8.1.0, I try to create an AVD use the "android" command. But it failed with Java exception.



      $ android -list targets



      Exception in thread "main" java.lang.NoClassDefFoundError: com/android/sdklib/repository/SdkRepoConstants
      at com.android.sdkmanager.SdkCommandLine.<init>(SdkCommandLine.java:340)
      at com.android.sdkmanager.Main.init(Main.java:222)
      at com.android.sdkmanager.Main.run(Main.java:148)
      at com.android.sdkmanager.Main.main(Main.java:117)
      Caused by: java.lang.ClassNotFoundException: com.android.sdklib.repository.SdkRepoConstants
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 4 more


      How can I fix it?
      Thanks a lot!



      Env.
      1. OS
      Ubuntu 18.04.1 LTS



      1. Java version
        openjdk version "1.8.0_181"
        OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
        OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)


      2. Android source code
        ./repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.1.0_r46


      3. Operations
        $ source build/envsetup.sh
        $ lunch aosp_arm-eng
        Build Android source code successfully!



      4. PATH



        /usr/lib/jvm/java-8-openjdk-amd64/bin:/dev/android/out/soong/host/linux-x86/bin:/dev/android/out/host/linux-x86/bin:/dev/android/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:/dev/android/development/scripts:/dev/android/prebuilts/devtools/tools:/dev/android/external/selinux/prebuilts/bin:/dev/android/prebuilts/misc/linux-x86/dtc:/dev/android/prebuilts/misc/linux-x86/libufdt:/dev/android/prebuilts/android-emulator/linux-x86_64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin








      java android avd






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 9:59









      fanzhou

      6415




      6415



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247591%2ffailed-to-use-android-command-to-create-avd-after-build-android-8-1-0%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53247591%2ffailed-to-use-android-command-to-create-avd-after-build-android-8-1-0%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto