Android Application Installed but won't open on device

adt, android, apk, eclipse, nfc

Solution

You should separate the intent filters into the following:

<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain"/>
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

For an intent filter to match, action, category and data should be correct. When you open the app via the icon, it will send a intent with MAIN action, and category LAUNCHER. Because it does not contain a data type, and because the category does not match DEFAULT and action does not match NDEF_DISCOVERED, Android thinks your intent filter can not handle it.

Problem

I created an application on Android. I am developing it on eclipse with ADT. It is about nfc. For the moment it only reads and writes tag. I run my application on my mobile device for testing and it works well. So it compiles well and runs well on my Xperia Z1 Sony, however when i unplug my phone and install the apk on it i have a problem : The install runs well but then i have two choices "Terminated" or "Open". The open is not clickable... I go to settings->Application->installed and i see my app that is install. I can force stop clear cache but not open it... I can't understand why. It runs well on my phone when i launch it from eclipse but when i want to run it on my phone unplugged from my computer it doesn't want to be open. No error message during installation... I activate dev mode and allow installation from unknown sources ect... Do someone have a clue ?? Here is my manifest.xml : ``` <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mynfc" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.NFC" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.mynfc.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".WriteATagActivity"/> </application> </manifest> ```

Original source