I'm using the following java code to check my user's hosts files to see if they blocked ads in my app (thus, I can pop up a plead window explaining why I need the ad money, etc):
public boolean IsAdBlocked()
{
BufferedReader in = null;
try
{
in = new BufferedReader(new InputStreamReader(new FileInputStream("/etc/hosts")));
String aLine;
while ((aLine = in.readLine()) != null) if (aLine.contains("admob")) return true;
}
catch (IOException e)
{
}
return false;
}
I call it from C++ with the following function:
bool JavaBridge_IsAdBlocked()
{
JNIEnv* threadEnv;
g_theJavaVirtualMachine->GetEnv ((void **) &threadEnv, JNI_VERSION_1_4);
jclass aObject = threadEnv->FindClass(ACTIVITY_NAME);
if(aObject==NULL) {return true;}
jmethodID aFunction = threadEnv->GetMethodID(aObject, "IsAdBlocked", "()Z");
if(aFunction==NULL) {return true;}
jboolean aBool=threadEnv->CallBooleanMethod(g_theGlobalRefToActivityInstance,aFunction);
threadEnv->DeleteLocalRef(aObject);
return (aBool!=0);
}
When the app crashes, I get the following stack trace:
#01 pc 00000000000484b3 /system/lib/libc.so (pthread_kill+34)
#02 pc 000000000001dd89 /system/lib/libc.so (raise+10)
#03 pc 0000000000019511 /system/lib/libc.so (__libc_android_abort+34)
#04 pc 0000000000017150 /system/lib/libc.so (abort+4)
#05 pc 000000000031ba35 /system/lib/libart.so (_ZN3art7Runtime5AbortEv+252)
#06 pc 00000000000b4ccb /system/lib/libart.so (_ZN3art10LogMessageD2Ev+866)
#07 pc 00000000001bc861 /system/lib/libart.so (_ZN3art22IndirectReferenceTable17AbortIfNoCheckJNIEv+84)
#08 pc 000000000023db6f /system/lib/libart.so (_ZNK3art22IndirectReferenceTable10GetCheckedEPv+498)
#09 pc 000000000023ad1f /system/lib/libart.so (_ZN3art9JavaVMExt12DecodeGlobalEPv+10)
#10 pc 0000000000335785 /system/lib/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+124)
#11 pc 000000000031789f /system/lib/libart.so (_ZN3art35InvokeVirtualOrInterfaceWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+42)
Can anyone explain what circumstances cause "ScopedObjectAccessAlreadyRunnable" to spiral away into total destruction?