android - Activity 未找到异常 : No Activity found to handle Intent

标签 android android-intent

我从 google play 收到的这份报告,我的应用程序崩溃时间:

  android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.android.gms.common.account.CHOOSE_ACCOUNT (has extras) }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1518)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1390)
at android.app.Activity.startActivityForResult(Activity.java:3204)
at com.example.uploadvideo.MainUploadToYoutube.authenticate(MainUploadToYoutube.java:287)
at com.example.uploadvideo.MainUploadToYoutube.onOptionsItemSelected(MainUploadToYoutube.java:211)
at android.app.Activity.onMenuItemSelected(Activity.java:2516)
at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:965)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:468)
at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:126)
at android.view.View$PerformClick.run(View.java:14155)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4508)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at dalvik.system.NativeStart.main(Native Method)

com.example.uploadvideo.MainUploadToYoutube 我有这个方法:

public void authenticate() {
    Intent accountChooserIntent =
        AccountPicker.newChooseAccountIntent(null, null,
            new String[] {GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, true, "Select an account", null,
            null, null);
    startActivityForResult(accountChooserIntent, REQUEST_PICK_ACCOUNT);
  }



 case REQUEST_PICK_ACCOUNT:
        if (resultCode == RESULT_OK) {
          mChosenAccountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
          tryAuthenticate();
        }

我找到这些 similar posts , How to solve “No Activity found to handle Intent” error

从这些帖子中,我了解到我需要重写 Intent 并将 Activity 添加到 list 中,对吗???

最佳答案

当您使用 Google Play 服务组件(AccountPicker)时,您需要确保 Google Play 服务在用户设备上存在并且是最新的,然后再调用使用该服务的方法,如 setup guide 中所述。 .

关于android - Activity 未找到异常 : No Activity found to handle Intent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17478471/

相关文章:

android - 如何从 Flutter 中的 Intent 加载图像?

Android Activity 在进入后台后两次收到相同的 Intent

java - 在 Android 上保持应用程序在后台运行

android - drawable-nodpi 拉伸(stretch) 9 补丁

java - 如何在全屏 Activity 中将 Edittext 推到键盘上方

java - Android html.fromhtml() url Intent

android - 使用 onActivityResult 时如何清除 Activity 历史记录

Android:在 htc Hero 上选择 Gmail 应用程序时,带有 EXTRA_STREAM 的 Intent.ACTION_SEND 不会附加任何图像

android - 只有在流程中添加帐户时,Google Signin 才会将显示名称返回为 null

android - 何时以及为什么应该使用 getResources()?