Search code examples
pythonpython-3.xappiumappium-androidpython-appium

Not able to run automation script of python(mac)


I am using https://github.com/appium/python-client framework to run automation.

I am getting below error while running scripts.

Exception: Message: An unknown server-side error occurred while processing the command. Original error: packageAndLaunchActivityFromManifest failed. Original error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

Also, I set ANDROID_HOME environment variables on mac.

Can somebody know how to fix it?


Solution

  • This error is not related to library you are using. Please run appium-doctor in terminal and see the output. It should be something like this

        info AppiumDoctor Appium Doctor v.1.4.3
        info AppiumDoctor ### Diagnostic starting ###
        info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
        info AppiumDoctor  ✔ Node version is 6.11.0
        info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
        info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
        info AppiumDoctor  ✔ DevToolsSecurity is enabled.
        info AppiumDoctor  ✔ The Authorization DB is set up properly.
        info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage
        info AppiumDoctor  ✔ HOME is set to: /Users/poornima
        info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/poornima/Library/Android/sdk
        info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
        info AppiumDoctor  ✔ adb exists at: /Users/poornima/Library/Android/sdk/platform-tools/adb
        info AppiumDoctor  ✔ android exists at: /Users/poornima/Library/Android/sdk/tools/android
        info AppiumDoctor  ✔ emulator exists at: /Users/poornima/Library/Android/sdk/tools/emulator
        info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
        info AppiumDoctor ### Diagnostic completed, no fix needed. ###
        info AppiumDoctor 
        info AppiumDoctor Everything looks good, bye!
        info AppiumDoctor 
    

    If Not

    Make sure your tools and platform tools are also added to path variable in bash profile.

    1. Open bash profile open ~/.bash_profile

    2. Add tools and platform tools

      export ANDROID_HOME=/Users/poornima/Library/Android/sdk
      export PATH=$ANDROID_HOME/platform-tools:$PATH
      export PATH=$ANDROID_HOME/tools:$PATH
      

    Refer this link: Could not find aapt with appium server