每次更新后应用程序快捷方式都会消失,我的清单有什么问题?
App shortcut disappears after every update, what's wrong with my Manifest?
我不知道为什么会这样,我已经尝试了所有方法。每次我更新应用程序时,主屏幕上以前的快捷方式都会消失。
这是我完整的应用程序清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.SpaceMonkey.Boats" android:versionCode="161" android:versionName="1.6.1">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
<application android:label="Boats" android:icon="@drawable/playstore"></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
我的主要 activity:
[Activity (Label = "Boats", Icon = "@drawable/playstore", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
我更新时唯一改变的是清单中的 versionCode 和 versionName,绝对没有其他改变。
我做错了什么?
编辑:我开始认为这是 Xamarin 在后台生成新应用程序清单的问题,我不确定如何检查。
编辑:我刚刚使用 Android (Xamarin) 应用程序进行了测试,该应用程序不使用 Xamarin.Forms,但没有出现该问题。我的怀疑证实了它与 Xamarin.Forms.
有关
问题出在 Xamarin Studio。我基本上重新创建了解决方案并复制了所有内容,然后问题就消失了...
我不知道发生了什么,但现在已经解决了。
在我的例子中,问题是通过更改我的 Android 应用程序项目的 AssemblyInfo.cs
的 AssemblyVersion
触发的。
此问题是由 Xamarin.Android 5.0 及更高版本引起的(不是 Xamarin.Forms)。正如所解释的 in the release documentation here:
With the 5.0 release, the default package names for Android Callable
Wrappers will be based on the MD5SUM of the assembly-qualified
name of the type being exported.
AssemblyVersion
是 assembly-qualified 名称 的一部分,任何版本更改都会创建一个新的 MD5 哈希,从而创建一个新的默认包名称。 (阅读更多关于 the assembly qualified named here)
应用程序快捷方式使用默认包名称启动您的应用程序,因此每次更新都会使快捷方式无效,系统会将其删除。
修复:不要更改 Android 项目中的 AssemblyVersion
或任何其他会更改程序集限定名称的内容。
我不知道为什么会这样,我已经尝试了所有方法。每次我更新应用程序时,主屏幕上以前的快捷方式都会消失。
这是我完整的应用程序清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.SpaceMonkey.Boats" android:versionCode="161" android:versionName="1.6.1">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
<application android:label="Boats" android:icon="@drawable/playstore"></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
我的主要 activity:
[Activity (Label = "Boats", Icon = "@drawable/playstore", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
我更新时唯一改变的是清单中的 versionCode 和 versionName,绝对没有其他改变。
我做错了什么?
编辑:我开始认为这是 Xamarin 在后台生成新应用程序清单的问题,我不确定如何检查。
编辑:我刚刚使用 Android (Xamarin) 应用程序进行了测试,该应用程序不使用 Xamarin.Forms,但没有出现该问题。我的怀疑证实了它与 Xamarin.Forms.
有关问题出在 Xamarin Studio。我基本上重新创建了解决方案并复制了所有内容,然后问题就消失了...
我不知道发生了什么,但现在已经解决了。
在我的例子中,问题是通过更改我的 Android 应用程序项目的 AssemblyInfo.cs
的 AssemblyVersion
触发的。
此问题是由 Xamarin.Android 5.0 及更高版本引起的(不是 Xamarin.Forms)。正如所解释的 in the release documentation here:
With the 5.0 release, the default package names for Android Callable Wrappers will be based on the MD5SUM of the assembly-qualified name of the type being exported.
AssemblyVersion
是 assembly-qualified 名称 的一部分,任何版本更改都会创建一个新的 MD5 哈希,从而创建一个新的默认包名称。 (阅读更多关于 the assembly qualified named here)
应用程序快捷方式使用默认包名称启动您的应用程序,因此每次更新都会使快捷方式无效,系统会将其删除。
修复:不要更改 Android 项目中的 AssemblyVersion
或任何其他会更改程序集限定名称的内容。