2016-04-24 89 views
0

我已經設置好一切正確,我不知道問題是什麼,我GOOGLE了一百次。谷歌玩遊戲服務需要一個元數據標籤

錯誤:

04-24 04:40:52.266 770-1829/com.google.android.gms E/PopupManager: No content view usable to display popups. Popups will not be displayed in response to this client's calls. Use setViewForPopups() to set your content view. 
04-24 04:40:52.270 770-1829/com.google.android.gms E/ValidateServiceOp: Using Google Play games services requires a metadata tag with the name "com.google.android.gms.games.APP_ID" in the application tag of the manifest for com.halafann.realhunter.realhunter 
04-24 04:40:52.274 1712-1712/com.halafann.realhunter.realhunter E/AndroidRuntime: FATAL EXCEPTION: main 
                        java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information. 
                         at com.google.android.gms.internal.eh$h.b(Unknown Source) 
                         at com.google.android.gms.internal.eh$h.a(Unknown Source) 
                         at com.google.android.gms.internal.eh$b.ec(Unknown Source) 
                         at com.google.android.gms.internal.eh$a.handleMessage(Unknown Source) 
                         at android.os.Handler.dispatchMessage(Handler.java:99) 
                         at android.os.Looper.loop(Looper.java:137) 
                         at android.app.ActivityThread.main(ActivityThread.java:4745) 
                         at java.lang.reflect.Method.invokeNative(Native Method) 
                         at java.lang.reflect.Method.invoke(Method.java:511) 
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                         at dalvik.system.NativeStart.main(Native Method) 

,你可以在這裏看到它沒有錯,除非我錯過的東西的活動:

public class GameHomeFragment extends BaseGameActivity implements View.OnClickListener { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.fragment_home2); 

     findViewById(R.id.sign_in_button).setOnClickListener(this); 
     findViewById(R.id.sign_out_button).setOnClickListener(this); 

    } 


//////////GOOGLE 

    private boolean isNetworkAvailable() { 
     ConnectivityManager connectivityManager 
       = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); 
     NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); 
     return activeNetworkInfo != null && activeNetworkInfo.isConnected(); 
    } 

    public void onSignInSucceeded() { 
     findViewById(R.id.sign_in_button).setVisibility(View.GONE); 
     findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE); 
    } 

    @Override 
    public void onSignInFailed() { 
     findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE); 
     findViewById(R.id.sign_out_button).setVisibility(View.GONE); 
    } 

    @Override 
    public void onClick(View view) { 
     if (view.getId() == R.id.sign_in_button) { 
      if (isNetworkAvailable()) { 
       beginUserInitiatedSignIn(); 
      } else { 
       Toast.makeText(GameHomeFragment.this, getResources().getString(R.string.home_internet_unavailable), Toast.LENGTH_LONG).show(); 
      } 

     } 
     else if (view.getId() == R.id.sign_out_button) { 
      signOut(); 
      findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE); 
      findViewById(R.id.sign_out_button).setVisibility(View.GONE); 
     } 
    } 

} 

的佈局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="@dimen/default_padding"> 

    <!-- sign-in button --> 

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

    <!-- sign-out button --> 

    <Button 
     android:id="@+id/sign_out_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Sign Out" 
     android:visibility="gone" /> 

      <TextView 
       android:id="@+id/google_signin_info" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:gravity="center" 
       android:text="@string/home_sign_info" 
       android:textAppearance="?android:attr/textAppearanceSmall" 
       android:textColor="@color/text_view_grey" /> 

    </LinearLayout> 

AndroidManifists:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    package="com.halafann.realhunter.realhunter"> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme" 
     tools:replace="android:label, android:icon"> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name=".game.fragments.GameHomeFragment"></activity> 


     <!-- Google Game Service --> 
     <meta-data 
      android:name="com.google.android.gms.games.APP_ID" 
      android:value="@string/app_id" /> 
     <meta-data 
      android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" /> 

    </application> 

</manifest> 

的build.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 
    repositories { 
     mavenCentral() 
    } 

    defaultConfig { 
     applicationId "com.halafann.realhunter.realhunter" 
     minSdkVersion 14 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:recyclerview-v7:23.1.1' 
    compile 'com.android.support:cardview-v7:21.0.0' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile ('com.github.florent37:materialviewpager:[email protected]'){ 
     transitive = true 
    } 
    compile 'com.google.android.gms:play-services:4.3.23+' 
    compile 'com.github.florent37:hollyviewpager:1.0.1' 
    compile 'com.github.ksoichiro:android-observablescrollview' 
    compile 'cn.pedant.sweetalert:library:1.3' 

    compile project(':BaseGameUtils') 
} 
+1

也許是因爲你在清單中有不同的軟件包名稱。我不確定Google組件如何訪問該標籤,但在清單中有'com.hello.me'。 –

+0

不,我只是編輯它,這是你現在看到的。所有好的但仍然是相同的錯誤:( – T3lemi

+0

你可能會嘗試清理/重建你的項目,特別是如果你已經編譯和運行一次後添加這些標籤 –

回答

-1

活動標記之前將您的元數據標籤。它爲我解決了這個問題。我有完全相同的問題。

相關問題