How can I DetectFaces in Amazon Rekognition AWS with Android Studio?


I have tried so many way but i can’t succeed. I haven’t found any source code examples for Android(about rekognition)

there’s a source code in JAVA in the Developer Guide but i cannot implement that even though I tried TT

I try to detect faces by sending an image file from an external storage(from the emulator)
I don’t know what i did wrong(I’m not good at coding)
Here is my code

and here is my errors

what is a null object reference?
i try to change the file path but he said no such file … and when I change to this path, there’s errors above.
by the way I’ve already asked a user for a permission to access a folder from Emulator in Android

please help me
PS. sorry for my bad English

Thank you in advance.


Now I am ok with the issues. I have been through many many things <3 <3 <3.
Thank you

I’m Thai and I had to try harder to find the solutions because there’s lack of information in the particular language. Here are my solutions.

My solutions are:

0.There is an endpoint for setting for the Rekognition–>

1.On a “null object reference issue” I found that I have to create a new object first such as “Image image = new Image();” <– The “new” command creates an object instance in that class

2.After the above error, there are more errors (Errors on NetworkOnMainThreadException), so I tried everything until I found this page –> the page said that …

enter image description here

Consequently, I looked up for more information about the AsyncTask and after that I created an AsyncTask class and then I move all my code about the initialize, the request, the response to the AsyncTask class. ตอนรันตอนท้ายๆน้ำตาจิไหล my code worked… TT and by the conclusion the sungyeol.jpg.jpg file worked

for example

for more information about the AsyncTask:

I hope these help 🙂

Leave a Reply