How to Mysql JDBC Driver to android studio

Solution 1:

  1. Download JDBC and extract the .jar file
  2. Open Android Studio and your project of interest
  3. Open your Left Panel, in the 1.Project Tab
  4. Right Click on your application module folder and go to New > Module and there Select Import .JAR/.AAR Package.
  5. In the first field you must insert the directory of the previously extracted .jar file. You can browse your folders by clicking on the far right icon with the 3 dots (...)

Once you have selected the .jar file and your project Synchronizes you can move on to the next steps:

  1. Right Click again on your application module folder and select Open Module Settings
  2. In the left navigation pane of the newly opened window, go to the category Modules and select app and then the Dependencies tab.
  3. There click on the green plus (+), and select Module Dependencies. Select the mysql module.
  4. Click OK, and close all the opened windows. A Synchronization process should take place once more.
  5. If everything has been done correctly, under your app module folder you should see a mysql-connector-java module folder.
  6. Don't forget to include the classes you want in your code.

Troubleshooting
In my case I had to uninstall the module and re-install it. The reason was that the module was compiled with Java 1.8 instead of 1.7 (currently supported by Android Studio ver:1.5.1).