phatez phatez - 4 months ago 21
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

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

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

and

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

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

Comments