2016-07-29 17 views
0

我想在C#中創建常用的G +註冊按鈕,Xamarin,但我得到錯誤,「LinearLayout不包含任何名爲com.google.android.gms.common.SignInButton的孩子「錯誤,「LinearLayout不包含任何名爲com.google.android.gms.common.SignInButton」

我也在android sdk中安裝了Google Play服務,並在Visual Studio中添加了組件。 但我不確定應該在Visual Studio中添加哪些Google Play服務。 請儘快提出建議。

請找到屏幕shot-

enter image description here

+0

你能發佈完整的錯誤信息嗎?這不是在截圖 –

+0

@ PRASHANT清楚,這裏充滿了錯誤味精...嚴重性\t代碼\t說明\t項目\t文件\t線\t抑制狀態 警告\t \t元素「的LinearLayout具有無效子元素「com.google。 android.gms.common.SignInButton」。可能的元素列表:'GLSurfaceView,AdapterView,AdapterViewAnimator,AutoCompleteTextView,MediaController,TextView,FragmentBreadCrumbs,AppWidgetHostView,GestureOverlayView,ExtractEditText,KeyboardView,RSSurfaceView,RSTextureView,SurfaceView, –

回答

0

您需要添加NuGet包的Xamarin.GooglePlayServices.Plus。這將安裝以下參考。

  • Xamarin.GooglePlayServices.Base
  • Xamarin.GooglePlayServices.Basement
  • Xamarin.GooglePlayServices.Plus

然後你就可以通過使用登錄佈局按鈕

<com.google.android.gms.common.SignInButton 
    android:id="@+id/sign_in_button" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 

注意:即使佈局設計師顯示警告,該應用程序也會運行,沒有任何問題。

+0

是@sJy,我添加了nuget包xamarin.GooglePlayServices.Plus也有3個引用你指定,但仍然得到該錯誤。 –

+0

@DhanshreeMore即使佈局設計者顯示警告,它也會在設備中運行,並且按鈕顯示正常。 – sJy

+0

耶謝謝。明白了:)工作正常 –

相關問題