Android java.lang.runtimeexception无法启动活动组件信息错误

Android java.lang.runtimeexception无法启动活动组件信息错误,android,Android,我需要将Google+集成到我的Android应用程序中,我正在遵循本教程,但当我运行我的项目时,emulator中会出现此消息,不幸的是,您的应用程序已停止,这是logcat中的错误: java.lang.runtimeexception unable to start activity componentinfo com.example.testgoogle/com.example.testgoogle.MainActivity:java.Lang.NullPointer.Exception

我需要将Google+集成到我的Android应用程序中,我正在遵循本教程,但当我运行我的项目时,emulator中会出现此消息,不幸的是,您的应用程序已停止,这是logcat中的错误:

java.lang.runtimeexception unable to start activity componentinfo com.example.testgoogle/com.example.testgoogle.MainActivity:java.Lang.NullPointer.Exception:Null options are permitted for this API.
我不知道如何解决这个问题。我需要你的帮助。提前谢谢你

这是我的日志:

04-15 07:42:38.906: W/GooglePlayServicesUtil(1315): Google Play services is missing.

04-15 07:42:38.936: W/GooglePlayServicesUtil(1315): Google Play services is missing.

04-15 07:42:39.666: E/GooglePlayServicesUtil(1315): Internal error occurred. Please see logs for detailed information

04-15 07:42:39.846: I/Choreographer(1315): Skipped 49 frames!  The application may be doing too much work on its main thread.

04-15 07:42:40.256: I/Choreographer(1315): Skipped 97 frames!  The application may be doing too much work on its main thread.

04-15 07:42:44.716: E/SettingsRedirect(1315): Can't redirect to app settings for Google Play services

通过使用初始化api客户端

// Initializing google plus api client
        mGoogleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(Plus.API, Plus.PlusOptions.builder().build())
        .addScope(Plus.SCOPE_PLUS_LOGIN).build();
使用
addApi(Plus.API,Plus.PlusOptions.builder().build())
而不是
addOnConnectionFailedListener(this).addApi(Plus.API,null)

不要使用null,使用Plus.PlusOptions.builder().build()


这肯定会解决您的问题

可能重复的“Google Play services丢失”是一个相当明显的问题。首先要弄清楚你的设备是否有Google Play Store应用程序?否则,您将无法使用此功能。如果您使用的是模拟器,请确保您使用的是谷歌API图像。非常感谢您的帮助,但我仍然有一个问题;当我运行我的项目时,会出现另一条消息“Google Play Services存在未知问题”,当我按“Ok”时,会出现另一条消息“如果没有Google Play Services,此应用程序将无法运行,因为您的手机中缺少Google Play Services”,但当我按“获取Google Play Services”按钮时,我单击“使用Google+登录”,消息就会消失“不幸的是,你的应用程序已停止”再次出现,应用程序已停止。请,我需要你的帮助。提前感谢