简体   繁体   English

下载Google Play服务

[英]Download Google Play Services

In my android app I use google play services to view google maps 在我的Android应用中,我使用Google Play服务查看Google地图

When a device does now have google play services installed, android shows a button says "Get Google Play Services" this button is from android itself, i did not create it. 当设备现在确实安装了Google Play服务时,Android会显示一个按钮,显示“获取Google Play服务”,此按钮来自android本身,我没有创建它。

the problem is that when ever user click on that button, app crashes. 问题是,只要用户单击该按钮,应用程序就会崩溃。

I tried to trace the code and debug but there is no code for this ( i did not create any code for it) 我试图跟踪代码并调试,但是没有为此的代码(我没有为此创建任何代码)

I get this error, not sure how this can be resolved. 我收到此错误,不确定如何解决。

any ideas? 有任何想法吗?

Thanks 谢谢

05-06 23:58:17.730    2695-2695/com.asmgx.schlogger.app D/AndroidRuntime﹕ Shutting down VM
05-06 23:58:17.730    2695-2695/com.asmgx.schlogger.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.asmgx.schlogger.app, PID: 2695
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)
            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)
            at android.app.Activity.startActivityForResult(Activity.java:3745)
            at android.app.Activity.startActivityForResult(Activity.java:3706)
            at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
            at android.app.Activity.startActivity(Activity.java:4016)
            at android.app.Activity.startActivity(Activity.java:3984)
            at com.google.android.gms.dynamic.zza$5.onClick(Unknown Source)
            at android.view.View.performClick(View.java:4780)
            at android.view.View$PerformClick.run(View.java:19866)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5257)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

You receive this error because you are running your code on an Android device that doesn't have the Google Play Store. 您收到此错误的原因是,您是在没有Google Play商店的Android设备上运行代码。

You can check if your intent will succeed like this: 您可以像这样检查您的意图是否成功:

if (intent.resolveActivity(getPackageManager()) != null) {
    startActivity(intent);
} else {
    //There isn't an app that handle your intent
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM