1
votes

I exported the project from unity 4D to Android project but when i run it iget this error

Unable to execute dex: Multiple dex files define Lcom/qualcomm/QCARUnityPlayer/BuildConfig; Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/qualcomm/QCARUnityPlayer/BuildConfig;

I did change the Project -> properties to include the Android 4.2.2 and Android Dependencies but i still not able to run it

1

1 Answers

1
votes

The reason is the exported project (from Unity) has the same package name "com.qualcomm/QCARUnityPlayer" as one defined in QCARUnityPlayer.jar.

Please take the steps as I did it successfully.

1) Create your activity that extends QCARPlayerNativeActivity

    package com.example.unitytest;

    import android.os.Bundle;
    import android.util.Log;

    import com.qualcomm.QCARUnityPlayer.QCARPlayerNativeActivity;

    public class MyUnityAR extends QCARPlayerNativeActivity{

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

        Log.i("Test", "MyUnityAR is running.");
      }
    }

2) Modify AndroidManifest.xml

< manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.unitytest" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal" >
...
< application android:icon="@drawable/app_icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
< activity android:name=".MyUnityAR" android:label="@string/app_name" android:screenOrientation="portrait" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >

3) Clean and Build, then enjoy.

Reference: https://developer.vuforia.com/resources/dev-guide/extending-unity-android-activity-and-adding-custom-views-eclipse