> Failed to find target with hash string 'android-26' in: /opt/android-sdk-linux

陌路散爱 提交于 2019-12-01 10:32:18
  1. remove all previous android sdk files from /opt/
  2. cd /opt && wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
  3. unzip sdk-tools-linux-3859397.zip -d android-sdk-linux

  4. nano /etc/profile.d/android.sh

paste this lines:

export ANDROID_HOME="/opt/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
  1. source /etc/profile

check android home:

echo $ANDROID_HOME
  1. in /opt/android-sdk-linux

    tools/bin/sdkmanager --update

    tools/bin/sdkmanager "platforms;android-26" "build-tools;26.0.2" "extras;google;m2repository" "extras;android;m2repository"

    tools/bin/sdkmanager --licenses

maybe enough at this point and the build will work...

but in my case missing some dependency, and check with

tools/bin/sdkmanager --list

update with the missing dependencies tools/bin/sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha9"

tools/bin/sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha9"

after these build success

thanks for help NinjaCoder about build tool version

Since your compileSDKVersion is 26, use latest version of build tools.

buildToolsVersion "26.0.2"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!