Android NDK hello-jni program throws error while building

438 Views Asked by At

i am new to NDK , i am trying to run the sample code that is present in NDK samples. I am using the guidelines under the following page: https://developer.android.com/tools/sdk/ndk/index.html#Downloads Under the "Exploring the hello-jni Sample", when i run the following command in Commandline:

android update project -p . -s

I am getting the following error: Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android update' command.

the below is the complete log:

ethics-14@ethics14-desktop:~/NDKworkspace/HelloJni$ android update project -p . -s
.Updated local.properties
Updated file ./proguard-project.txt
Updated local.properties
Updated file ./tests/proguard-project.txt
Error: The project either has no target set or the target is invalid.
Please provide a --target to the 'android update' command.

Also under project.properties file i am able to see: target=android-21

2

There are 2 best solutions below

1
On

It seems that your files are saved with the wrong case, the file should be named project.properties with a lowercase p.

0
On

this looks like a bug in the android tool: a part of the project is actually updated to the latest android target (including the target property inside project.properties), but then it's failing at some point.

To work around this issue, you can manually specify the android target:

android update project -p . -s -t android-21