[英]loading a Unity Vuforia Project in a Subview in Android throws Fatal Exception
I'm building an Augmented Reality application using Unity
with the Vuforia SDK
. 我正在使用Unity
和Vuforia SDK
来构建增强现实应用程序。 I've successfully built my project directly from Unity
to Android
. 我已经成功地从Unity
到Android
成功构建了我的项目。 Now I'm trying to run my unity project in a subview of an Android project which I have written in Eclipse. 现在,我试图在用Eclipse编写的Android项目的子视图中运行我的unity项目。 I've imported my project as a library from Unity to Eclipse. 我已经将项目作为一个库从Unity导入到Eclipse。 I've set all the libraries correctly (external jars etc). 我已经正确设置了所有库(外部jars)。 Below is the code of my onCreate
method where the unity project should be loaded in a FrameLayout
named framelayout2 下面是我的onCreate
方法的代码,其中应将统一项目加载到名为framelayout2的FrameLayout
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);
}
But the project crashes with the following error in the LogCat: 但是该项目因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
Has anyone attempted anything similar? 有没有人尝试过类似的东西? Can you please help me? 你能帮我么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.