【发布时间】:2016-06-23 22:45:46
【问题描述】:
我正在使用 Visual Studio 2015 并创建了一个基于 PCL 的项目。这个应用程序所做的只是显示一个启动屏幕,然后导航到下一页。我无法让它在 Android 上运行。这是splash screen的链接
我得到的错误:
应用程序无法启动。确保应用程序具有 已安装到目标设备并具有可启动的活动 (MainLauncher = true)。
此外,检查 Build->Configuration Manager 以确保这一点 项目为此配置设置为 Deploy。
我已关注this link 并尝试了那里的所有解决方案,但结果仍然相同
有什么技巧可以解决这个问题吗?
编辑
Android 清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Splash.Splash" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
<!--suppress UsesMinSdkAttributes-->
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:icon="@drawable/icon-3" android:name="mono.android.app.Application" android:allowBackup="true" android:label="Splash.Splash" android:debuggable="true">
<activity android:label="Splash screen" android:name="md5ac585b47313c1dc414c7b7a18f93e457.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:icon="@drawable/icon-3" android:noHistory="true" android:theme="@style/Theme.Splash" android:name="md5ac585b47313c1dc414c7b7a18f93e457.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="Splash.Splash.mono.MonoRuntimeProvider.__mono_init__" />
<!--suppress ExportedReceiver-->
<receiver android:name="mono.android.Seppuku">
<intent-filter>
<action android:name="mono.android.intent.action.SEPPUKU" />
<category android:name="mono.android.intent.category.SEPPUKU.STM.STM" />
</intent-filter>
</receiver>
</application>
</manifest>
编辑
下面的新清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Super.Super" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<application android:icon="@drawable/stmicon-3"></application>
</manifest>
【问题讨论】:
-
确保之前的应用程序已卸载。使用
adb uninstall <package name>手动将其从您的设备中删除。 -
我也做了这个,还是没有效果
-
你能发布你最终的 AndroidManifest.xml 吗?它会在你的 obj/android 文件夹中。
-
将其添加到问题中
-
尝试从其中一项活动中删除 MainLauncher。你有两个。
标签: android visual-studio xamarin xamarin.forms