Android target: Command failed with EACCES

Hi all,

I’ve just started having a look at Meteor again, last experience was pre version 1. Starting from scratch again and I’m following the simple to do list task. As far as I can tell I’ve done everything I should but I’m getting an error when trying to add the android platform. Looks like a permission issue and I’ve tried changing the permissions on gradle as that was one suggestion I found. That didn’t work though.

$ meteor add-platform android
android: added platform                       
                                          
Your system does not yet seem to fulfill all requirements to build apps for Android.
                                          
Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/cordova.html#installing-prerequisites

Status of the individual requirements:        
✓ Java JDK                                    
✓ Android SDK                                 
✗ Android target: Command failed with EACCES: avdmanager list target
        spawn avdmanager EACCES
✓ Gradle

Anyone know how to fix this Android target issue? I’m using Meteor version 2.7.3

Thank you :slight_smile:

Hi @lemmyjnr
Are you using the m1?

This happens because you didn’t configure correctly your PATH for Android Studio.

Check the documentation here: Cordova | Meteor Guide

Hi @hschmaiske

Using Ubuntu on WSL not M1

Here are my paths:

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export ANDROID_HOME=/etc/Android/Sdk
export ANDROID_SDK_ROOT=/etc/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$ANDROID_HOME/cmdline-tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export ANDROID_BIN=/opt/android-studio-2021.2.1/android-studio/bin

Not sure what I’m doing wrong, seems the docs are a bit out of date.

I cannot test the PATHs because I’m using M1, but I’m going to share mine here, so maybe this can help you

export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=${ANDROID_HOME}
export PATH=${PATH}:${ANDROID_HOME}/emulator
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

I’m also using Java SDK 8 and I’ve created a Virtual Device on Android Studio, add any model (e.g. Pixel 4) with Android 11 (API 30)

Thank you for your reply.

I added the path to emulator but it didn’t make any difference. Also I don’t have a tools directory which is why I added build-tools and cmdline-tools to my path. I’ve got Android Studio installed and that works, I’ve added devices to it too.

…maybe file permission - cordova build android error spawn EACCES when I update Android Studio 3.0(Gradle 4.1) · Issue #2835 · ionic-team/ionic-cli · GitHub

@paulishca @hschmaiske

Thank you for your replies. I’m getting somewhere with this now, it has driven me crazy all day. Not sure its entirely fixed but at least I now see android: added platform after adding it.

Problems that needed resolved:
1 - Android SDK and Studio was installed as root, changed owner to $USER:$USER
2 - /dev/kvm permission denied. changed this to 777 which I know is bad so I’ll need to look at that again
3 - Path issue with cmdline-tools, had to add /latest/bin so the line in my .bashrc file is

export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

That’s enough for today, I’m taking a break.