I'm working on a native c/c++ app, that uses string resources via the strings.xml file.
Attempting to use AAssetManager to load the "strings.xml" file, has no effect. Returns the same error
I've tried looking for various other implementations, but none have worked
Android API level (Project): 25
Android API level (Device): 30
The code I've attempted to use so far is the following:
JNIEnv* jni;
g_App->activity->vm->AttachCurrentThread(&jni, NULL);
jclass rcl = jni->FindClass("com.avetharun.rosemary.R$string");
// attempted the above as well as "... R.string" instead of "... R$string"
jfieldID fid = jni->GetStaticFieldID(rcl, "app_name", "s");
// attempted the above as well as "Ljava/lang/String;" instead of "s"
jstring jstr = (jstring)jni->GetObjectField(rcl, fid);
const char* str = jni->GetStringUTFChars(jstr, 0);
Directory tree:
assets
- test.txt
res
- values
- - strings.xml
strings.xml :
<string name="app_name">Rosemary Project</string>
Running this causes an error: 0x0000007f1881daac in __rt_sigtimedwait ()
from libc.so, as well as "Sequence contains more than one element"