0

私自身がうまく動作するサードパーティのゲームアプリケーションを持っています。ここでは、元のAndroidManifest.xmlは次のとおりです。ゲームは別のアクティビティから起動しません

<?xml version="1.0" encoding="utf-8" standalone="no"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"  android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" package="com.thirdpartycompany.appname"> 

    ...... 

    <application android:debuggable="false" android:icon="@drawable/app_icon" android:label="@string/app_name"> 
     <activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:label="@string/app_name" android:launchMode="singleTask" android:name="com.abc.ThirdPartyActivity" android:screenOrientation="fullSensor"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
       <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> 
      </intent-filter> 

     ...... 

     </activity> 

     ...... 

     <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 1095208937458"/> 
     <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ 1095208937458"/> 

     ...... 

    </application> 

    ...... 

</manifest> 

私はその後、別のアクティビティのMyActivityを追加し、次のコードを追加:ここで

 Intent intent = new Intent(); 
     intent.setClassName("com.thirdpartycompany.appname", "com.abc.ThirdPartyActivity"); 
     startActivityForResult(intent, 7774); 

は新しいのAndroidManifest.xmlです:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" package="com.thirdpartycompany.appname"> 
    <application android:debuggable="false" android:icon="@drawable/app_icon" android:label="@string/app_name"> 
     <activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:label="@string/app_name" android:name="com.abc.ThirdPartyActivity" android:screenOrientation="fullSensor"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name="com.mycompany.MyActivity" android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 1095208937458" /> 
     <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ 1095208937458" />   
    </application>    
</manifest> 

新しいアプリケーションを起動すると、次の例外が発生します。

FATAL EXCEPTION [main] 
Unity version  : 4.5.5f1 
Device model  : intel I861B3L2CA51 
Device fingerprint: intel/inet_alc5651_64/inet_alc5651:5.1.1/LMY47V/inet-soft0204291144:userdebug/release-keys 
- [FATAL EXCEPTION [main] 
Unity version  : 4.5.5f1 
Device model  : intel I861B3L2CA51 
Device fingerprint: intel/inet_alc5651_64/inet_alc5651:5.1.1/LMY47V/inet-soft0204291144:userdebug/release-keys 
] : java.lang.Error: FATAL EXCEPTION [main] 
Unity version  : 4.5.5f1 
Device model  : intel I861B3L2CA51 
Device fingerprint: intel/inet_alc5651_64/inet_alc5651:5.1.1/LMY47V/inet-soft0204291144:userdebug/release-keys 

Caused by: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information. 
    at com.google.android.gms.internal.hb$h.b(Unknown Source) 
    at com.google.android.gms.internal.hb$h.d(Unknown Source) 
    at com.google.android.gms.internal.hb$b.fv(Unknown Source) 
    at com.google.android.gms.internal.hb$a.handleMessage(Unknown Source) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5258) 
    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) 

googleで検索したところ、Initializing Games Client in AndroidI can't initialize Google Play game serviceが見つかりました。推奨される解決方法は、AndroidManifest.xmlに

<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" /> 
    <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/app_id" /> 

を追加することです。 AndroidManifest.xmlにはすでに2つの行がありますが、同じ例外があります。誰がここで何が起こったのか知っていますか?ありがとう!

+0

マニフェストに「com.mycompany.MyActivity」を追加しました。「com.thirdpartycompany.MyActivity」であってはなりませんか?パッケージ名は正しいですか? – W0rmH0le

+0

「com.mycompany.MyActivity」、「com.abc.ThirdPartyActivity」および「com.thirdpartycompany.appname」はすべて正しいです。この問題はGoogle Playゲームサービスに関連する可能性がありますが、元のアプリケーションはうまく機能します。 – user3869992

答えて

0

あなたがしようとした場合:

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.thirdpartycompany.appname"); 
if (launchIntent != null) { 
    startActivity(launchIntent); 
} 

あなたは同じ結果を持っていますか?

+0

これを試してみると、com.abc.ThirdPartyActivityではなくMyActivityが起動しますか? MyActivityの内部からcom.abc.ThirdPartyActivityを起動する必要があります。 – user3869992

+0

ああ、申し訳ありません。 AndroidManifest.xmlで宣言されたアクティビティを起動します。 – jos

+0

私はこれを見つけましたが、決してそれを試しません。だから、うまくいけば投稿してうれしいよ! :)インテントの意図=新しいインテント(); intent.setComponent(新しいComponentName( "com.thirdpartycompany.appname"、 "com.abc.ThirdPartyActivity")); startActivity(インテント); – jos

関連する問題