我正在尝试在我的应用程序中设置 Google 登录。我在 XML 文件中遇到错误
我的 XML
<TextView
android:id="@+id/hello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<com.google.android.gms.common.SignInButton
android:id="@+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/hello"
android:layout_toRightOf="@+id/sign_revoke" />
<Button
android:id="@+id/sign_revoke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/sign_in_button"
android:text="Revoke Access"/>
错误
10-03 05:17:46.757: E/AndroidRuntime(1191): FATAL EXCEPTION: main
10-03 05:17:46.757: E/AndroidRuntime(1191): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample_google/com.example.sample_google.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class com.google.android.gms.common.SignInButton
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.os.Looper.loop(Looper.java:123)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-03 05:17:46.757: E/AndroidRuntime(1191): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 05:17:46.757: E/AndroidRuntime(1191): at java.lang.reflect.Method.invoke(Method.java:507)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-03 05:17:46.757: E/AndroidRuntime(1191): at dalvik.system.NativeStart.main(Native Method)
10-03 05:17:46.757: E/AndroidRuntime(1191): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class com.google.android.gms.common.SignInButton
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.Activity.setContentView(Activity.java:1657)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.example.sample_google.MainActivity.onCreate(MainActivity.java:37)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-03 05:17:46.757: E/AndroidRuntime(1191): ... 11 more
10-03 05:17:46.757: E/AndroidRuntime(1191): Caused by: java.lang.reflect.InvocationTargetException
10-03 05:17:46.757: E/AndroidRuntime(1191): at java.lang.reflect.Constructor.constructNative(Native Method)
10-03 05:17:46.757: E/AndroidRuntime(1191): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
10-03 05:17:46.757: E/AndroidRuntime(1191): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
10-03 05:17:46.757: E/AndroidRuntime(1191): ... 21 more
10-03 05:17:46.757: E/AndroidRuntime(1191): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.R$drawable
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.internal.u.b(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.internal.u.a(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.common.SignInButton.c(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.common.SignInButton.d(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.common.SignInButton.setStyle(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): at com.google.android.gms.common.SignInButton.<init>(Unknown Source)
10-03 05:17:46.757: E/AndroidRuntime(1191): ... 24 more