phatez phatez - 1 year ago 138
Android Question

Android app won't open after i install. But it can run in emulator

I have exported my app from eclipse and installed it on my phone. After installation, I click open from package installer, but the installer force close. Afterwards, when I tried to launch the app, nothing happen after I click it. I click the app in app drawer but it return to home screen instead.

I am able to run in emulator and in debug mode when I connect my device via usb, but not when I export the apk to install.

Note that this is not the first app that I exported to install. Previous apps are working fine.

Answer Source

I found the problem! I had declared the activity 2 times in the manifest with different properties, like:

<activity android:name=".myclass"></activity> 


<activity android:name=".myclass" android:label="@string/app_name">
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 

Remove the unwanted one from the manifest and it will work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download