I have installed Android Studio with the idea of developing applications with Cordova and Phonegap thanks to the help of my partner @karel who showed me this question: How to install Android Studio on Ubuntu? I followed the instructions exactly, but even so I have several errors. When you start Android Studio with the following command, sudo -E /opt/google/android-studio/bin/studio.sh this shows the first error:

Gtk-Message: 09:07:14.283: Failed to load module "canberra-gtk-module"

(java:13968): IBUS-WARNING **: 09:07:14.566: 
The owner of /home/miguel/.config/ibus/bus is not root!

I installed the SDK, (I think I installed the necessary ones) and when I returned to a Cordova project, and I ran cordova requirements to see if everything was OK, the result was the following:

Android Studio project detected

Requirements check results for android:
Java JDK: installed 11.0.2
Android SDK: installed true
Android target: not installed 
avdmanager: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 5 more
Gradle: not installed 
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle 
in your path, or install Android Studio
Some of requirements check failed

What did I do wrong? What can I do to correct this and be able to run my applications on Cordova and Phonegap?

  • 1
    Android Studio is installed with permissions that allow a normal user to use the application without being root including installing plugins. Android Studio requires JDK 8 by default, however you can install JDK 8 (openjdk-8-jdk) and JDK 11 alongside each other, and Android Studio will select JDK 8 as the default JDK if it is installed. When I installed Android Studio I did not have any Java installed, and the Android Studio installer installed whatever JDK 8, Gradle and Android SDK it required as part of the installation of Android Studio. – karel Feb 19 at 15:41
  • 1
    I accepted all the defaults when installing Android Studio and let it install whatever software it needed. After you install Android Studio and open it as normal user for the first time, the first step is to locate the Configure link on the Android Studio splash screen and select Create Desktop Entry which creates an Android Studio icon in the Dash, which is the way to launch Android Studio by clicking on its icon from then on. – karel Feb 19 at 15:47
  • 1
    When I installed Android Studio I installed it on a fresh instance of Ubuntu because I was feeling adventurous and wanted to customize it. I disagreed with a few things in the Ask Ubuntu answer that I read, and I wanted to try installing it my way. This turned Android Studio into a beast, and I had to delete everything halfway through the installation process and start over from scratch by accepting all the defaults and following the steps in the Ask Ubuntu answer that I was using to the letter without changing anything. – karel Feb 19 at 15:52
  • Thank you for your support @karel, I do not understand very well what you want to say. I have followed the steps of the installation and nevertheless I have the errors that I show and I can not work with cordova. What do you suggest I do? I have not created any cone on the board, in fact, if I put: Android Studio in Ubuntu Software, I get Andriod Studio to install it, as if I had not installed it. – Miguel Espeso Feb 19 at 16:09
  • 1
    In a nutshell my fairly recent version of Android Studio is using JDK 8, not JDK 11, and your Android Studio is using JDK Java 11. As far as I know Android Studio requires JDK 8. – karel Feb 19 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.