I'm building an Augmented Reality application using Unity
with the Vuforia SDK
. I've successfully built my project directly from Unity
to Android
. Now I'm trying to run my unity project in a subview of an Android project which I have written in Eclipse. I've imported my project as a library from Unity to Eclipse. I've set all the libraries correctly (external jars etc). Below is the code of my onCreate
method where the unity project should be loaded in a FrameLayout
named 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);
}
But the project crashes with the following error in the 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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.