0

我正在尝试让一个项目同时使用 Facebook Unity 插件和(几个)Prime31 插件。我正在尝试创建自己的活动来扩展 Prime31 活动,并且还结合了此处给出的 Facebook 解决方法:与 android manifest 上的活动标签冲突:Unity3d 中的 Facebook 和 Google Play 游戏

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

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

知道有什么问题吗?

4

1 回答 1

0

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

于 2014-04-15T05:06:51.350 回答