I’m wondering if there is a way to access R class attribute from native code, I need it to read some generated ID that may change every time i do a clean build of my project and I would prefer not to pass them manually to the native part.
EDIT
As suggested from @trashkalmar here is the solution:
static const char* const strClassName = "your/app/package/R$string";
clazz = env->FindClass(strClassName);
if (clazz == NULL) {
LOGE("Can't find class %s\n", strClassName);
return result;
}
jfieldID field = env->GetStaticFieldID(clazz , "you_string_resource", "I");
jint value = env->GetStaticIntField(clazz, field);
Access your R class and read its fields as any other classes.