Search code examples
androidc++java-native-interfacesharedpreferences

SharedPreferences fail to save data if setting APP_OPTIM := release


the SharedPreferences is called through jni from c++ code.
When APP_OPTIM := debug, the preference is saved, but not for release.

What does APP_OPTIM := release do?


Solution

  • UPDATE: It turns out the in the jni code, the return is omitted, perhaps with APP_OPTIM := debug, the return is added and for release, the return is omitted.

    int getPreference(string x)
    {
        jniGetPreference(x);
    }
    
    
    int getPreference(string x)
    {
        return jniGetPreference(x);
    }