Search code examples
androidsdkappceleratorappcelerator-titaniumubuntu-20.04

Setup Android SDK for Appcelerator Titanium


appc ti setup check tells me that Android SDK not found. appc ti info suggested to tell Titanium where the Android SDK is located. The Android SDK is intalled in /usr/lib/android-sdk. If I try to setup Android SDK, then I run into the following error:

$ appc titanium setup android
Appcelerator Command-Line Interface, version 8.1.1
Copyright (c) 2014-2020, Appcelerator, Inc.  All Rights Reserved.

Enter ctrl-c at any time to quit.

───────────────────┤ Android Settings ├───────────────────

Path to the Android SDK
Enter "none" if you don't want to build for Android.
: /usr/lib/android-sdk
[ERROR] Invalid Android SDK path
Required file does not exist: "/usr/lib/android-sdk/tools/android"

I found this issue documented here. I tried to follow the solution under section "manual way":

  1. install cmdline-tools, how to do it properly is documented here.

  2. then I used sdkmanager to update packages as it mentioned.

    /usr/lib/android-sdk
     ├── build-tools
     │   ├── 27.0.1 -> debian
     │   └── debian
     │       └── lib
     ├── cmdline-tools
     │   └── tools
     │       ├── bin
     │       └── lib
     ├── extras
     │   └── android
     │       └── m2repository
     ├── licenses
     ├── platforms
     │   ├── android-23
     │   └── android-29
     │       ├── data
     │       ├── optional
     │       ├── skins
     │       └── templates
     ├── platform-tools
     │   ├── api
     │   ├── lib64
     │   └── systrace
     │       └── catapult
     └── tools
         ├── bin
         └── proguard
             ├── bin
             └── lib
     

But the issue still exists. Can someone please explain me what this issue is about exactly?


Solution

  • Uninstall my android sdk:

    $ sudo apt-get autoremove android-sdk libcanberra-gtk-module
    $ sudo rm -r /opt/adroid-sdk
    

    Download cmdline-tools from https://developer.android.com/studio#cmdline-tools and install it:

    $ mkdir /opt/adroid-sdk
    $ mkdir /opt/adroid-sdk/cmdline-tools
    $ sudo unzip commandlinetools-linux-6858069_latest.zip
    $ sudo mv cmdline-tools /opt/adroid-sdk/cmdline-tools/6858069
    

    Setting my environment variables nano ~/.bashrc and after I refresh source ~/.bashrc:

    export ANDROID_SDK_ROOT=/opt/android-sdk
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/cmdline-tools/6858069/bin
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    export PATH=$PATH:$ANDROID_SDK_ROOT/tools
    

    Then I installed sdk packages

    • Android SDK tools

    • Android SDK Platfom-tools

    • Android SDK Build tools (29.0.3)

    • Android 10.0 (API 29) SDK Platform

    • other APIs

      $ sudo env "PATH=$PATH" sdkmanager "extras;google;m2repository" "extras;android;m2repository" "system-images;android-29;default;x86_64" "build-tools;29.0.3" "platform-tools" "platforms;android-29"
      

    Once installed you can create simulators via the CLI.

    $ appc ti setup check
    Android Environment
      ✓  sdk                installed (/opt/android-sdk)
      ✓  tools              installed (v26.1.1)
      ✓  platform tools     installed (v30.0.5)
      ✓  build tools        installed (v29.0.3)
      ✓  adb                installed /opt/android-sdk/platform-tools/adb
      ✕  android            "android" executable not found; please reinstall