1
我正在使用Unity
和Vuforia SDK
構建增強現實應用程序。我已經成功地將我的項目從Unity
直接構建到Android
。現在我試圖在Eclipse中編寫的Android項目的子視圖中運行我的統一項目。我已經將項目導入爲Unity到Eclipse的庫。我已經正確設置了所有的庫(外部罐子等)。下面是在統一的項目應在FrameLayout
名爲framelayout2加載在Android的子視圖中加載Unity Vuforia項目會引發致命異常
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中出現以下錯誤的我onCreate
方法的代碼:
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
有沒有人嘗試任何事類似?你能幫我麼?
您是否複製過具有所有權限的清單文件? – PravinCG
是的,但我認爲它與vuforia的NDK部分有關 – Sergios