Log in or register to post comments

extending QCARPlayerActivity

February 14, 2013 - 7:52am #1

 

Good afternoon everybody,

I'm trying to extend a Unity Android Activity and adding custom views in Eclipse.

I've used Unity3d 4.0 Pro Trial Version to export a project to Eclipse and force the Android tarjet to v2.2.

I've followed this guide https://developer.vuforia.com/resources/dev-guide/extending-unity-android-activity-and-adding-custom-views-eclipse.

On Unity I can generate the .APK with my own 3d model and it run perfectly in my Android device. Then, after build tha Android library based on /StartingArea folder from Unity project and build an Android project to call this library as the guide says, Elcipse show me the next errors at Run time::

02-14 16:47:53.700: E/AndroidRuntime(1031): FATAL EXCEPTION: main

02-14 16:47:53.700: E/AndroidRuntime(1031): java.lang.NoClassDefFoundError: com.qualcomm.QCARUnityPlayer.QCARUnityPlayer
02-14 16:47:53.700: E/AndroidRuntime(1031): at com.qualcomm.QCARUnityPlayer.QCARPlayerSharedActivity.onCreate(QCARPlayerSharedActivity.java:210)
02-14 16:47:53.700: E/AndroidRuntime(1031): at com.qualcomm.QCARUnityPlayer.QCARPlayerActivity.onCreate(QCARPlayerActivity.java:37)
02-14 16:47:53.700: E/AndroidRuntime(1031): at com.Viso.ARUnityVuforia.QCARJavaActivity.onCreate(QCARJavaActivity.java:21)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.os.Handler.dispatchMessage(Handler.java:99)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.os.Looper.loop(Looper.java:132)
02-14 16:47:53.700: E/AndroidRuntime(1031): at android.app.ActivityThread.main(ActivityThread.java:4028)
02-14 16:47:53.700: E/AndroidRuntime(1031): at java.lang.reflect.Method.invokeNative(Native Method)
02-14 16:47:53.700: E/AndroidRuntime(1031): at java.lang.reflect.Method.invoke(Method.java:491)
02-14 16:47:53.700: E/AndroidRuntime(1031): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-14 16:47:53.700: E/AndroidRuntime(1031): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-14 16:47:53.700: E/AndroidRuntime(1031): at dalvik.system.NativeStart.main(Native Method)
 
Anyone can help me please?¿
 
This is the AndroidProject's file system ready to call the library:: 
 
and this is the library project file system on Eclipse
 
 
Thanks in advance.,
 
 

extending QCARPlayerActivity

February 20, 2013 - 8:37am #10

You're welcome.

Of cousrse, if you find some solution or tip/trick that is worth sharing with the Vuforia community (for instance some special Unity or Eclipse settings or procedure), you are more than welcome to post back here! 

extending QCARPlayerActivity

February 20, 2013 - 7:51am #9

ok, thanks for the reply.

I've already read that Unity threat., but anybody give a solution. I'll try again on Unity forums.

thanks again!!

 

extending QCARPlayerActivity

February 20, 2013 - 4:57am #8

Hi, it could be related to the Trial version, but I cannot tell for sure;

actually, this sounds a bit like a Unity / Eclipse related issue, I don't think this is caused by Vuforia;

just to say that it's maybe worth checking in the Unity forum; here I found an article talking about your issue:

http://forum.unity3d.com/threads/71607-Integrating-Unity-and-Eclipse/page3

You may want to check there as well.

extending QCARPlayerActivity

February 20, 2013 - 4:51am #7

I emphasize that I'm working with Unity3d 4.0 Pro Trial Version to export a project to Eclipse and get the StartingArea folder to build the lib.

It's posibble that the erros occurs because my Unity is a TRIAL version?¿? I think that may be the reason that I can not integrate a Unity QCAR activity in my Android project. getting the next errorLog::

 

02-19 17:03:58.070: W/dalvikvm(1469): ERROR: Unable to find decl for native Lcom/unity3d/player/UnityPlayer;.nativeKeysPressed:(Ljava/lang/String;)V
02-19 17:03:58.070: E/dalvikvm(1469): JNI posting fatal error: com/unity3d/player/UnityPlayer
02-19 17:03:58.070: E/dalvikvm(1469): VM aborting

extending QCARPlayerActivity

February 15, 2013 - 9:30am #6

Check this guide and verify that you have installed and configured Java, Eclipse, ADT, Android SDK and Android NDK as described:

https://developer.vuforia.com/resources/dev-guide/step-1-setting-development-environment-android-sdk

Then, as I said before, double-check that you performed all the steps exactly as described in the article about Unity-Eclispe integration.

Other than that, if you do everything as described, it should work in the end.

 

extending QCARPlayerActivity

February 15, 2013 - 8:59am #5

 

So would you know how I could solve the JNI error....,

02-15 17:26:38.290: W/dalvikvm(1090): ERROR: Unable to find decl for native Lcom/unity3d/player/UnityPlayer;.nativeKeysPressed:(Ljava/lang/String;)V

02-15 17:26:38.290: E/dalvikvm(1090): JNI posting fatal error: com/unity3d/player/UnityPlayer
02-15 17:26:38.290: E/dalvikvm(1090): VM aborting
 
..maybe it's necessary download somo aditional framework or API to work with JNI?¿
 
thanks.

extending QCARPlayerActivity

February 15, 2013 - 8:44am #4

Running from Eclipse is fine, but Eclipse will automatically build the APK and upload it into your device when you Run the app (so the building process is automatically handled by Eclipse).

For your second error, maybe try closing and reopening Eclipse (sometime a simple project refresh can help too);

normally if you followed all the steps in the dev guide article and if you applied the tip of my last message, it should work.

 

 

extending QCARPlayerActivity

February 15, 2013 - 8:38am #3

 

Hi, thanks for the reply!.

The point is that I'm testing the project running it directly from Eclipse on my Android device...I don't build the APK previously . Is that a necessary step?

Anyway I have checked all the libraries/jars in the list as you would propose and know I get the next error::

02-15 17:26:38.290: W/dalvikvm(1090): ERROR: Unable to find decl for native Lcom/unity3d/player/UnityPlayer;.nativeKeysPressed:(Ljava/lang/String;)V

02-15 17:26:38.290: E/dalvikvm(1090): JNI posting fatal error: com/unity3d/player/UnityPlayer
02-15 17:26:38.290: E/dalvikvm(1090): VM aborting
 
Any ideas?
 
thanks for your help!!

extending QCARPlayerActivity

February 14, 2013 - 11:10am #2

Hi,

the stack trace indicates that some libraries (jars) have not been exported, so they are not inside your APK; therefore the runtime VM cannot find some classes;

you need to make sure that the various libraries are included in the APK during the build;

go to project -> Properties -> Java Build Path -> select the Tab called "Order and Export" and check (tick) all the libraries/jars in the list. Click Apply or OK, refresh the project and then it should be OK.

Hope this helps.

 

Log in or register to post comments