【问题标题】:Conflict with activity tags on android manifest: Facebook and Prime31 plugins in Unity3d与 android manifest 上的活动标签冲突:Unity3d 中的 Facebook 和 Prime31 插件
【发布时间】:2013-11-21 22:54:04
【问题描述】:

我正在尝试让一个项目同时使用 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

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

【问题讨论】:

  • 澄清:com/dqsoft/ChampHearts/ 下的类 DQUnityPlayerActivity 的路径是什么?我不知道 .DQUnityPlayerActivity 实际上适用于您的 androidmanifest.xml,我通常将完整路径放入其中,尽管从错误中可以清楚地推断出完整路径。

标签: unity3d facebook-unity-sdk prime31


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 2019-08-10
    • 1970-01-01
    • 1970-01-01
    • 2014-11-13
    • 1970-01-01
    相关资源
    最近更新 更多