与Android清单上的活动标签冲突:Unity3d中的Facebook和Prime31插件

时间:2013-11-21 22:54:04

标签: unity3d facebook-unity-sdk prime31

我正在尝试使用Facebook Unity插件和(几个)Prime31插件的项目。我正在尝试创建自己的活动,扩展Prime31活动,并在此处包含Facebook的解决方法:Conflict with activity tags on android manifest: Facebook and Google Play Games in Unity3d

到目前为止,我有一个看起来像这样的课程:

import android.content.Intent;
import android.os.Bundle;
import com.facebook.Session;

public class DQUnityPlayerActivity extends com.prime31.UnityPlayerProxyActivity
{
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
  } 
}

我用javac编译它,将其打包为.jar文件,并将其放在/ Assets / Plugins / Android中。我修改了我们的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name=".DQUnityPlayerActivity" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
etc...

现在我已经陷入困境:此时,当我尝试在我的测试设备上运行它时,找不到该类。亚行向我展示了这一点:

E/AndroidRuntime(16863): FATAL EXCEPTION: main
E/AndroidRuntime(16863): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.dqsoft.ChampHearts/com.dqsoft.ChampHearts.DQUnityPlayerActivity}: java.lang.ClassNotFoundException: com.dqsoft.ChampHearts.DQUnityPlayerActivity in loader dalvik.system.PathClassLoader[/mnt/asec/com.dqsoft.ChampHearts-1/pkg.apk]
E/AndroidRuntime(16863):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
E/AndroidRuntime(16863):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime(16863):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime(16863):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime(16863):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(16863):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(16863):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(16863):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(16863):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(16863):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
E/AndroidRuntime(16863):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/AndroidRuntime(16863):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(16863): Caused by: java.lang.ClassNotFoundException: com.dqsoft.ChampHearts.DQUnityPlayerActivity in loader dalvik.system.PathClassLoader[/mnt/asec/com.dqsoft.ChampHearts-1/pkg.apk]
E/AndroidRuntime(16863):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
E/AndroidRuntime(16863):    at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
E/AndroidRuntime(16863):    at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
E/AndroidRuntime(16863):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime(16863):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
E/AndroidRuntime(16863):    ... 11 more

知道可能出现什么问题吗?

1 个答案:

答案 0 :(得分:0)

您需要将导出的jar文件放在Assets / Plugins / Android /文件夹中,并确保在DQUnityPlayerActivity类中有以下行: package com.dqsoft.ChampHearts;