CloudyKooper CloudyKooper - 3 months ago 12
Android Question

Why is my command line android list targets showing nothing?

I'm running windows 10 with Android Studios installed but I'm doing all this from the command line. I downloaded the latest android sdk. then i downloaded project files from github.

I ran a build ndk-build. i assume it is successful because it took about 20 minutes or so. In a sub folder

libs/mips
where files were generated:
liblept.so
,
libpng.so
, and
libtess.so
.

Then I tried to run an android update project command like this:

C:\Program Files (x86)\Android\android-sdk\tools>android update project -p c:\tess\tess-two


I made sure that inside the tess-two folder there is
AndroidManifest.xml
.

I get this error message:

Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android.bat update' command.


After researching the Android Development page I ran this command :

C:\Program Files (x86)\Android\android-sdk\tools>android list targets


the result was just a single line with no lists if targets like this without an error message or anything:

Available Android targets:

How can i get the project to update as the example I'm trying to follow here suggests.

I tried solution found here "android list target" show nothing for AOSP build ...but got error message that i needed a target id before I could build an AVD.

I tried some random target IDas but they were not valid..What am i doing wrong?

Thanks for any help.

EDIT: NEW INFO
Thanks for helping, I got the list by using: "android list" instead of "android target list". Must be a windows version; I just upgraded to Windows 10.

So here's what I got. The thing is how do I know which target id to use? In my AndroidManifest.xml file I see this attribute:

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="20" />


I have three folders: "armeabi-v7a","mips","x860". Each folder has three files: "liblept.so","libpng.so","libtess.so". Is the list of targets that I found related to the targetSdkVersion or any of the three library files?

I'm not sure which one to use with android update project --path . --target.

Here's the list that was found:

C:\android-sdk\android-sdk-windows\platforms>android list
Available Android targets:
Available Android Virtual Devices:

The following Android Virtual Devices could not be loaded:
Name: Nexus_5_API_22_x86
Path: C:\Users....android\avd\Nexus_5_API_22_x86.avd
Error: Unknown target 'Google Inc.:Google APIs:22' in C:\Users....android
\avd\Nexus_5_API_22_x86.ini
Available devices definitions:
id: 0 or "tv_1080p"
Name: Android TV (1080p)
OEM : Google

Tag : android-tv



id: 1 or "tv_720p"
Name: Android TV (720p)
OEM : Google

Tag : android-tv



id: 2 or "wear_round"
Name: Android Wear Round
OEM : Google

Tag : android-wear



id: 3 or "wear_square"
Name: Android Wear Square
OEM : Google

Tag : android-wear



id: 4 or "Galaxy Nexus"
Name: Galaxy Nexus

OEM : Google



id: 5 or "Nexus 10"
Name: Nexus 10

OEM : Google



id: 6 or "Nexus 4"
Name: Nexus 4

OEM : Google



id: 7 or "Nexus 5"
Name: Nexus 5

OEM : Google



id: 8 or "Nexus 6"
Name: Nexus 6

OEM : Google



id: 9 or "Nexus 7 2013"
Name: Nexus 7

OEM : Google



id: 10 or "Nexus 7"
Name: Nexus 7 (2012)

OEM : Google



id: 11 or "Nexus 9"
Name: Nexus 9

OEM : Google



id: 12 or "Nexus One"
Name: Nexus One

OEM : Google



id: 13 or "Nexus S"
Name: Nexus S

OEM : Google



id: 14 or "2.7in QVGA"
Name: 2.7" QVGA

OEM : Generic



id: 15 or "2.7in QVGA slider"
Name: 2.7" QVGA slider

OEM : Generic



id: 16 or "3.2in HVGA slider (ADP1)"
Name: 3.2" HVGA slider (ADP1)

OEM : Generic



id: 17 or "3.2in QVGA (ADP2)"
Name: 3.2" QVGA (ADP2)

OEM : Generic



id: 18 or "3.3in WQVGA"
Name: 3.3" WQVGA

OEM : Generic



id: 19 or "3.4in WQVGA"
Name: 3.4" WQVGA

OEM : Generic



id: 20 or "3.7 FWVGA slider"
Name: 3.7" FWVGA slider

OEM : Generic



id: 21 or "3.7in WVGA (Nexus One)"
Name: 3.7" WVGA (Nexus One)

OEM : Generic



id: 22 or "4in WVGA (Nexus S)"
Name: 4" WVGA (Nexus S)

OEM : Generic



id: 23 or "4.65in 720p (Galaxy Nexus)"
Name: 4.65" 720p (Galaxy Nexus)

OEM : Generic



id: 24 or "4.7in WXGA"
Name: 4.7" WXGA

OEM : Generic



id: 25 or "5.1in WVGA"
Name: 5.1" WVGA

OEM : Generic



id: 26 or "5.4in FWVGA"
Name: 5.4" FWVGA

OEM : Generic



id: 27 or "7in WSVGA (Tablet)"
Name: 7" WSVGA (Tablet)

OEM : Generic



id: 28 or "10.1in WXGA (Tablet)"
Name: 10.1" WXGA (Tablet)
OEM : Generic

Answer

To ensure that you have at least one target available for use, navigate to your sdk/installation/path/platforms and see if you have any version of android in there.

This is the output I get with android list targets:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Available Android targets:
----------
id: 1 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 4
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/armeabi-v7a
----------
id: 2 or "android-22"
     Name: Android 5.1.1
     Type: Platform
     API level: 22
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 3 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 1
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/armeabi-v7a, default/x86, default/x86_64
----------
id: 4 or "Google Inc.:Google APIs (x86 System Image):19"
     Name: Google APIs (x86 System Image)
     Type: Add-On
     Vendor: Google Inc.
     Revision: 15
     Description: Android x86 + Google APIs
     Based on Android 4.4.2 (API level 19)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/x86
----------
id: 5 or "Google Inc.:Google APIs:22"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 5.1.1 (API level 22)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64

I see you are building tess-two, so this is the command I used when I got to that part:

android update project --path . --target 3

Note I used . as the path because I was already in the tess-two folder and . in linux represents the current folder.