Android target : not installed

大城市里の小女人 提交于 2019-12-22 18:05:14

问题


I am unable to run ionic run android. After I checked with cordova requirements, it shows

Android target: Not installed
Android SDK not found.

How should I solve the problem? I have my SDK in D drive where I have set ANDROID_HOME and path correctly, I suppose

Also, I do android list target, it shown as below. How should I intsall it if it is needed to fix teh error?

Attached the cordova android version


回答1:


You can follow this link set ANDROID_HOME which I got help from or follow below guide.

I had similar trouble but managed to fix it. After successful installation of android studio, Android SDK will be downloaded by default to a directory like this "C:\Users\abc\AppData\Local\Android\sdk1" where "abc" in this case is your PC name. AppData is a hidden folder.

Next step is to set ANDROID SDK path. From Advanced System Settings, click Environment Variables then under User variables add New as shown below.

Next, add android 'tools' and 'platform-tools' to System variables' 'Path' as shown below. These tools are inside sdk folder.

Set up is done. Open cmd and issue android command. If all is well, you should see below output.

Finally open a new terminal window and navigate to your cordova project directory, in my case "hello" and check platfrom requirements. All should be fine now.




回答2:


I had a similar problem. The issue was I was using the latest version of Java which was 10.0.1

You can check yourself by typing in terminal:

java --version

And it was

java 10.0.1 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

Currently, Cordova needs on their documentation page as JDK 8. SEE DOC HERE

You can download JDK 8 from the official website here

Once you download you need to set up JAVA_HOME variable. Use this for setting up JAVA HOME when you have multiple version of JAVA installed.

Then you can run

cordova requirements 

or

cordova build android

This worked for me. Hope it helps someone.



来源:https://stackoverflow.com/questions/44903644/android-target-not-installed

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