Search code examples
javaandroidjava-native-interface

Unable to get access to a Java function from JNI


In a Java class (myClass), I have the following method :

public Location getPointSuivantBase().

I want to use it from JNI. When I try to get an id for this function with

idGetPointSuivantBase=env->GetMethodID(jMyClass,"getPointSuivantBase","()Landroid/location/Location;");

the app crashes saying that this function doesn't exist.

The same call, used for a Location class function (env->GetMethodID(jLocation,"getLatitude","()D")) correctly returns an id for the function.

What could cause the problem?


Solution

  • The problem was there because the getPointSuivantBase was not used anymore in the Java code and, in my debug build type, the "minify enabled" option was set to true.