Cannot find a compatible Android SDK for compilation when running `tns platform add android`

混江龙づ霸主 提交于 2019-11-30 04:38:24

Alright, so you need to make sure of following:

  • Make sure you have API 22 installed.
  • Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes, specifically 22.x.x)
  • Make sure you have Android support repository installed. (You can find it under Extras section in Android SDK Manager)

Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.

For Windows User:

  1. Run 'android update sdk' from command line
  2. Select Android 5.1.1(API22)
  3. Select Tools folder
  4. Select Extras and click on Install.

ps:- adding this answer, so that if any one land on this page can see it.

llj

This is because of sudo. The root user has no ANDROID_HOME set.

  1. Check the ANDROID_HOME is ok
  2. Install the API 22 + ion the Extras > Android Support Repository
  3. Run the following

    • tns platform remove android
    • tns platform add android@next
  4. Run

    tns run android

then it should be OK

I solve this problem installing Android Support Repository from Extras.

on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed C:\Program Files (x86)\Android\android-sdk

updating SDK in AndroidStudio >> Preferenceswould help

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