Android应用程序在FragmentActivity.java上崩溃android.support.v4.app.FragmentActivity.startActivityForResult

时间:2017-01-31 06:12:20

标签: android crash fragment

在我的应用程序中他们没有FragmentActivity.java但崩溃报告给我以下错误

Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms&pcampaignid=gcore_8487000--- flg=0x80000 pkg=com.android.vending }
   at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1647)
   at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
   at android.app.Activity.startActivityForResult(Activity.java:3415)
   at android.app.Activity.startActivityForResult(Activity.java:3376)
   at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
   at android.app.Activity.startActivity(Activity.java:3611)
   at android.app.Activity.startActivity(Activity.java:3579)
   at com.google.android.gms.dynamic.zza$5.onClick(Unknown Source)
   at android.view.View.performClick(View.java:4204)
   at android.view.View$PerformClick.run(View.java:17373)
   at android.os.Handler.handleCallback(Handler.java:725)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:5056)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
   at dalvik.system.NativeStart.main(NativeStart.java)

我不知道问题究竟是什么和在哪里以及Redmi手机发生此次崩溃的大部分时间

3 个答案:

答案 0 :(得分:1)

如果设备没有安装谷歌播放(没有Activity来处理此intent),则会发生异常 - 在这种情况下,您可以尝试在browser中尝试打开网址:< / p>

您可以使用google play包名称:com.android.vending

String pakcage_name="com.android.vending";

 public static void open_google_play(Context context) {
    try {
        //open in play store app directly
        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pakcage_name)));
    } catch (android.content.ActivityNotFoundException e) {
        //open in browser
        openBrowser(context, "https://play.google.com/store/apps/details?id=" + pakcage_name);
    }
}

public static void openBrowser(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    if (null != intent.resolveActivity(context.getPackageManager())) {
        context.startActivity(intent);
    }
}

button点击此方法时使用它:

open_google_play(Activity.this);

答案 1 :(得分:0)

它表示你没有活动来处理它。 这是谷歌游戏商店失踪。尝试将代码放入try catch block

答案 2 :(得分:0)

您尝试启动Intent来查看Google Play商店,但手机上不存在这种情况,从而导致崩溃。您应首先检查意图是否可以解决,如下所示:

if (intent.resolveActivity(activity.getPackageManager()) != null) {
    startActivity(intent)
}