Launching Android apk from installation crashes looking for ResolverActivity?

1.3k views Asked by At

One of my colleagues was trying to load my APK from an internal web site and then opening it from the installer. The application crashes at launch time with the following stack and referring to an activity that I do not have. I believe it is because I (temporarily) have two entry points for my application from the manifest, therefore, a resolver (chooser) is needed.

Is this true?

02-04 13:57:15.880 E/AndroidRuntime( 4183): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mycompany.android.myapp/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml?
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.Activity.startActivityForResult(Activity.java:2758)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.Activity.startActivity(Activity.java:2864)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.packageinstaller.InstallAppProgress.onClick(InstallAppProgress.java:191)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.View.performClick(View.java:2420)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.View.onTouchEvent(View.java:4235)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.widget.TextView.onTouchEvent(TextView.java:6642)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.View.dispatchTouchEvent(View.java:3765)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1713)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1131)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.Activity.dispatchTouchEvent(Activity.java:2070)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1697)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1716)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.os.Looper.loop(Looper.java:123)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at android.app.ActivityThread.main(ActivityThread.java:4363)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at java.lang.reflect.Method.invokeNative(Native Method)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at java.lang.reflect.Method.invoke(Method.java:521)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
02-04 13:57:15.880 E/AndroidRuntime( 4183):     at dalvik.system.NativeStart.main(Native Method)

Here is a piece of the manifest. Notice the Welcome and the Settings activities. Both have intent filters for Launcher with Main and that is what needs to be "resolved" before starting the activity. Apparently other installers just grab one (at random, first, etc.)?

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

    <activity android:name=".ui.AboutActivity"
              android:label="@string/title_edit_profile">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

   <activity android:name=".ui.SettingsActivity"
              android:label="@string/title_settings" 
              android:windowSoftInputMode="stateAlwaysHidden|adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.provider.Settings.ACTION_SYNC_SETTINGS"/>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
1

There are 1 answers

0
mobibob On BEST ANSWER

Having more than one Activity that matches on the intent-filter may require a Resolver to choose among the matching options. Remove one of the MAIN / LAUNCHER intent filters or add a Resolver with a chooser dialog to launch.