1

我正在Unity使用Vuforia SDK. 我已经成功地直接从Unityto构建了我的项目Android。现在我正在尝试在我用 Eclipse 编写的 Android 项目的子视图中运行我的统一项目。我已将我的项目作为库从 Unity 导入到 Eclipse。我已经正确设置了所有库(外部罐子等)。下面是我的onCreate方法的代码,其中应将统一项目加载到FrameLayout名为 framelayout2 中

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;

import com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity;
import com.qualcomm.QCARUnityPlayer.QCARUnityPlayer;
import com.qualcomm.QCARUnityPlayer.QCARPlayerProxyActivity;


public class MainActivity extends Activity {
public QCARUnityPlayer m_UnityPlayer;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    m_UnityPlayer = new QCARUnityPlayer(this);
    int glesMode = m_UnityPlayer.getSettings().getInt("gles_mode", 1);
    boolean trueColor8888 = false;
    m_UnityPlayer.init(glesMode, trueColor8888);
    setContentView(R.layout.activity_main);

    FrameLayout layout = (FrameLayout) findViewById(R.id.frameLayout2);     

    LayoutParams lp = new LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);

    layout.addView(m_UnityPlayer.getView(), 0, lp);

}

但是该项目在 LogCat 中因以下错误而崩溃:

11-16 13:35:06.676: I/QCAR(11889): onSurfaceCreated
11-16 13:35:06.676: W/dalvikvm(11889): No implementation found for native Lcom/qualcomm/QCAR/QCAR;.onSurfaceCreated ()V
11-16 13:35:06.686: W/dalvikvm(11889): threadid=11: thread exiting with uncaught exception (group=0x40c631f8)
11-16 13:35:06.686: D/KeyguardViewMediator(2050): setHidden true
11-16 13:35:06.686: E/AndroidRuntime(11889): FATAL EXCEPTION: GLThread 507
11-16 13:35:06.686: E/AndroidRuntime(11889): java.lang.UnsatisfiedLinkError: onSurfaceCreated
11-16 13:35:06.686: E/AndroidRuntime(11889):    at com.qualcomm.QCAR.QCAR.onSurfaceCreated(Native Method)
11-16 13:35:06.686: E/AndroidRuntime(11889):    at com.qualcomm.QCARUnityPlayer.QCARUnityPlayer.onSurfaceCreated(QCARUnityPlayer.java:39)
11-16 13:35:06.686: E/AndroidRuntime(11889):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1446)
11-16 13:35:06.686: E/AndroidRuntime(11889):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
11-16 13:35:06.686: W/ActivityManager(2050):   Force finishing activity com.samsung.arapp.gr/.MainActivity

有没有人尝试过类似的事情?你能帮我么?

4

1 回答 1

0

好像这个人也有同样的问题。看看他在这里采取的步骤

于 2012-11-19T01:03:25.107 回答