3

When trying to install Android Studio on my Linux Laptop, I get "Unable to Run mksdcard tool" From what I can tell from searching, this is usually caused by lacking the 32 bit compatibility libraries on 64 bit Linux, however I am running it on an ARMv7 processor, using the crouton project to use Linux on my Chromebook. I have tried install the recomended packages ending in i386, but the command line returned:

Reading Package Lists... Done
Building Dependendency Tree
Reading State information... Done
E: unable to locate package [Name of package here]
E: Couldn't find any package by Regex '[Name of package]'

Does anyone know what is causing this and how I can fix it?

  • I'm not sure this question is clear enough, because to me it reads like you're trying to put 32-bit x86 libraries on a 32-bit ARM Chromebook because of 64-bit... something..., and that makes very little sense whatsoever. Unless possibly you're trying to cross-compile x86 code on an ARM host system for, er, _reasons_, but that's a highly unusual thing to be doing. – Notlikethat Jan 06 '16 at 23:05
  • I'm relatively new to linux, So I tried putting in the packages recommended to other users with similar issues in order to fix the error when I try to install android studio, but attempting to do so did not work. Judging by your reaction, I assume that was not the right path to take. I'm mostly trying to get the program to run, moreso than anything else. Sorry for any confusion. – Donald Brown Jan 07 '16 at 00:32
  • OK, where exactly are you installing Android Studio from? The download from the website is almost certainly a non-starter - if parts of that fail on 64-bit x86 due to missing 32-bit native libraries, that implies they contain 32-bit x86 code, which isn't going to run at all on an ARM machine. Unless you've found a ready-made ARM version, you're probably looking at building it (or at least the native code parts) from source yourself. – Notlikethat Jan 07 '16 at 19:43
  • 1
    Possible duplicate of [Error: Unable to run mksdcard SDK tool in ubuntu](http://stackoverflow.com/questions/29241640/error-unable-to-run-mksdcard-sdk-tool-in-ubuntu) – tripleee Aug 11 '16 at 09:50

2 Answers2

3

I've discovered a workaround.

After a little searching, I've found that we can create executable binary of the tool for the ARMv7 platform ourselves! Whupee!

  1. Head over to GitHub and pick up the source code, mksdcard.c. Download this to wherever you'd like, but make sure you download it as mksdcard.c and not as mksdcard.c.txt, which your browser might try to do. You can always rename the file later in case you accidentally save the filename incorrectly.
  2. Over in your chroot environment, head to the directory where you downloaded the file.
  3. Make sure you have the gcc compilation tools installed. Try running gcc -v in an attempt to see what version of GCC you have installed. If this doesn't work, you'll need to install GCC via sudo apt-get install gcc.
  4. Run gcc -o mkdscard mksdcard.c. This uses GCC to compile the source code into something that can be executed. After compilation has completed, you can use ./mkscard to have Linux execute the binary file, which verifies that it works.
  5. Navigate to your Android SDK Tools directory. This is usually ~/Downloads/Android/Sdk/tools. By running ls, you'll list the files and find the version of mksdcard that your Linux distribution doesn't understand how to run. (Running ./mksdcard on this file will confirm this.)
  6. Backup the broken binary somewhere, then delete the copy in the tools folder. (I created a backups/ directory within the Android SDK Tools folder to move it to.)
  7. Within the directory, use rm -r mksdcard to delete the old mksdard binary.
  8. Finally, copy your compatible binary over to take it's place, e.g. cp ~/Downloads/mksdcard . (Copies the mksdcard binary we've created to the current directory ., the Android SDK Tools folder.)
  9. Head back over to your Android Studio installer. In the dialogue complaining about mksdcard failing, hit Retry and the installation should continue. After it's finished, be sure to apply any updates that are recommended by the environment. Enjoy!
Mapsy
  • 4,192
  • 1
  • 37
  • 43
  • Environment: CentOS7. I am following the procedure as advised above. Renamed the original executable mksdcard to mksdcard.txt. Downloaded, placed mksdcard.c in ../sdk/tools/ and compiled using "gcc -o mkdscard mksdcard.c". It created executable binary mksdcard. But, getting exception bashc: .: mksdcard: cannot execute binary file. Please guide me! – AVA Sep 10 '18 at 06:46
1

For newer versions eg. 3.1 C4 of Android Studio running with Ubuntu on ARM32 you will also need to place mksdcard in ~/Downloads/Android/Sdk/emulator (referencing like path from Alext T.).