#include <jni.h>
#include <string>
#include <opencv2/opencv.hpp>
using namespace cv;
#include <iostream>
extern "C" JNIEXPORT jstring JNICALL
Java_com_example_cppinandroid_MainActivity_stringFromJNI( JNIEnv* env,
                            jobject)
{
    Mat image;
    image = imread( "/home/<name>/a.png", 1 );
    if ( !image.data )
    {
        return env->NewStringUTF( "No data in image!" );
    } else
    {
        return env->NewStringUTF( "Data is in image" );
    }
}
That's what I have in Native Cpp part of the android project.
When I run the application with emulator, it always shows: "No data in image!" text.
I have compiled this program separately as a normal c++ opencv program. It is working perfectly fine.
I have given the absolute path too. Is that not enough?  
Do  I have to write something in build.gradle also?   
I am using Android studio, if that matters.
 
    