user20358
user20358

Reputation: 14736

Xamarin Forms - PCL project The app could not be started

I am using Visual Studio 2015 and have a PCL based project created. All this application does is show a splash screen and then navigate to the next page. I am unable to get this to work on Android. Here is the link for the splash screen

The error I get:

The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).

Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.

I have followed this link and tried all the solutions there and still have the same result

Any tips to fix this?

Edit

Android Manifest File

<?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>

Edit

New Manifest below

<?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>

Upvotes: 2

Views: 819

Answers (2)

jzeferino
jzeferino

Reputation: 7850

EDITED: There was more than one problem in your question. I addressed two of them but the last one was the icon name.

Android resources can't have the '-' character in the name. so this is the correction:

<application android:icon="@drawable/stmicon3"></application>

Initial answer:

Its wrong to have two activities with the same intent filter for launching.

So, first on your Manifest, remove entirely the two Activities tags.

For helping debugging this. please change your manifest to this (yes we are ignoring the Provider too)

So your final Manifest would be:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.yournamespace.courier">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
<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:label="yournamespace"> 
    </application>
</manifest>

After this, were gonna set the SplashActivity as MainLauncher:

[Activity(MainLauncher = true,
        NoHistory = true)]
public class SplashActivity : AppCompatActivity

And finally the MainActivity:

 [Activity(Icon = "@drawable/icon")]
public class MainActivity : FormsAppCompatActivity

Upvotes: 0

TheMoFaDe
TheMoFaDe

Reputation: 373

enter image description here

You Can Do As Jon Sugguested Or Just Go Into Your Android Device Settings & Application Manager And uninstall the previous version of the application on your android device

Upvotes: 0

Related Questions