Android 三星S7牛轧糖一段时间后,共享偏好为零
我正在SharedReferences中保存一个密钥。在尝试立即检索时,它会返回值。但一段时间后,它返回一个nil值。这在三星S7牛轧糖中尤为常见,几乎适用于所有其他设备,如Nexus、Mi、Oppo等。我反复检查了几次,但我没有在保存和检索之间更改键的值 我注意到三星在卸载应用程序后没有清除首选项(我在三星S6中进行了检查)。那么三星设备是否存在任何问题,或者是否存在我不考虑的环路漏洞。 请帮忙Android 三星S7牛轧糖一段时间后,共享偏好为零,android,sharedpreferences,android-preferences,samsung-mobile,android-7.0-nougat,Android,Sharedpreferences,Android Preferences,Samsung Mobile,Android 7.0 Nougat,我正在SharedReferences中保存一个密钥。在尝试立即检索时,它会返回值。但一段时间后,它返回一个nil值。这在三星S7牛轧糖中尤为常见,几乎适用于所有其他设备,如Nexus、Mi、Oppo等。我反复检查了几次,但我没有在保存和检索之间更改键的值 我注意到三星在卸载应用程序后没有清除首选项(我在三星S6中进行了检查)。那么三星设备是否存在任何问题,或者是否存在我不考虑的环路漏洞。 请帮忙 <application android:name="android.sup
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="false"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:launchMode="singleTask"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activities.SplashActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data
android:host=“xx.com"
android:scheme=“xx”
android:pathPrefix="/"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activities.AutomatedTestActivity"
android:screenOrientation="portrait" />
<activity android:name=".activities.PasswordCancelActivity"></activity>
</application>
我注意到三星没有明确的偏好
正在卸载应用程序(我在三星S6中进行了检查)。那么有什么问题吗
和三星设备或有任何环孔我不考虑。
请帮忙
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="false"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:launchMode="singleTask"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activities.SplashActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data
android:host=“xx.com"
android:scheme=“xx”
android:pathPrefix="/"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".activities.AutomatedTestActivity"
android:screenOrientation="portrait" />
<activity android:name=".activities.PasswordCancelActivity"></activity>
</application>
在android mainfest应用程序标记中更改android:allowBackup:false
。
即使卸载了应用程序,也会存储其真实备份
来自android开发者文档
android:allowBackup是否允许应用程序参与
备份和恢复基础架构。如果此属性设置为
false,将不会执行应用程序的备份或恢复,
即使是一个完整的系统备份,否则会导致
通过adb保存的应用程序数据。此参数的默认值
属性为true
发布您的代码,以便我们可以找到准确的problem@bharath请查找上面的代码。在我将allowbackup更改为false后,它在生成“清单合并”失败时引发异常。多个清单必须冲突。你可以通过提供工具来覆盖它:replace=“allowBackup”我没有在清单文件中多次添加allowBackup!所以不可能有冲突。请参考上面我刚刚添加的代码。@Akaanksha u可以看到合并的清单(当项目中的libries或子模块使用相同的属性时会发生冲突)。检查导致错误的属性并尝试重写