7

I have read all the documentation I found on how to integrate Unity3D projects targeted to Android into eclipse. The reason I want to do that is to be able to call the Unity3D Activity within my own "normal" Android application.

Well, I tried to follow the steps listed on this tutorial. Using all the combinations I can imagine, I did the following:

  1. I used the Unity Android project and built it (within the Unity IDE), then copied the /Temp/StagingArea/ folder to another location.

  2. I created a new Android project, using create from existing sources, setting the location of the StagingArea copy folder. This would be the Android Library Project. Check "is Library" on properties -> Android.

  3. Again, I create an Android project, import the previusly created Android Library project and classes.jar.

  4. I move the asset folder contents from the Library project to the "Activity" project. It has two subfolders, bin and libs.

  5. I modify the generated Activity to extend UnityPlayerActivity and remove the setContent line of the onCreate method. Change the package to match the Unity Player bundle id.

  6. Add the corresponding lines to manifest, basically those that are on the Library project.

So everything compiles without errors, and I can run the project, shows the splash screen, and then a black screen, playing the sounds of my Unity Scene correctly. The logcat reveals the following errors:

01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.415: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.415: I/Unity(2299): StopQCAR
01-26 16:51:46.415: I/Unity(2299): UnityEngine.Debug:Internal_Log(Int32, String, Object)
01-26 16:51:46.415: I/Unity(2299): UnityEngine.Debug:Log(Object)
01-26 16:51:46.415: I/Unity(2299): UnityEngine.MonoBehaviour:print(Object)
01-26 16:51:46.415: I/Unity(2299): TrackerBehaviour:StopQCAR()
01-26 16:51:46.415: I/Unity(2299): TrackerBehaviour:OnApplicationPause(Boolean)
01-26 16:51:46.415: I/Unity(2299):  
01-26 16:51:46.415: I/Unity(2299): (Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/Export/Generated/UnityEngineDebug.cpp Line: 34)
01-26 16:51:46.425: D/dalvikvm(2299): Trying to load lib /data/data/es.fundacionvf.unity.gps/lib/libQCARWrapper.so 0x40515a38
01-26 16:51:46.425: E/Unity(2299): Unable to find QCARWrapper
01-26 16:51:46.425: I/Unity(2299): DllNotFoundException: QCARWrapper
01-26 16:51:46.425: I/Unity(2299):   at (wrapper managed-to-native) TrackerBehaviour:stopTracker ()
01-26 16:51:46.425: I/Unity(2299):   at TrackerBehaviour.StopQCAR () [0x00000] in <filename unknown>:0 
01-26 16:51:46.425: I/Unity(2299):   at TrackerBehaviour.OnApplicationPause (Boolean pause) [0x00000] in <filename unknown>:0 

Just to mention... read these two SO questions: 1 and 2. They seem to have succeded, so it is possible to achieve following those steps (or similar).

I also found useful this topic on the Unity3D forum, which basically describes the same proccess in a clearer way.

Has anybody experienced this issue? Any suggestion or alternative?

Regards.

Community
  • 1
  • 1
mdelolmo
  • 6,417
  • 3
  • 40
  • 58

3 Answers3

8

For anyone stumbling across this, the integration of Unity3d into an android eclipse project was broken in the previous version (3.5)!

Using a newer version of Unity (successfully tested with 3.5.2) everything works fine again following these steps.

If you want to define your own activity or use Unity inside a fragment, you can use the UnityPlayer class directly. To do so you can have a look at [UNITY_INSTALLATION]\Editor\Data\PlaybackEngines\androidplayer\src\com\unity3d\player as mentioned in the Unity Forum.

Or just try this code that worked for us:

    UnityPlayer mPlayer = new UnityPlayer(getActivity()); // Put your activity object here
    int glesMode = mPlayer.getSettings().getInt("gles_mode", 1);
    boolean trueColor8888 = false;
    mPlayer.init(glesMode, trueColor8888);

    // Get the view - e.g. to return from the fragment method onCreateView:
    View view = mPlayer.getView();

Update: The first link is not available on the unity3d support page anymore, but the forum entry contains all needed steps too!

sunadorer
  • 3,855
  • 34
  • 42
  • It's quite better to get the latest ones rather than the old ones to use it with less flaws! – David Dimalanta Jun 12 '13 at 10:42
  • @sunadorer // the first link is broken. – Youngjae Jun 14 '13 at 02:08
  • @DavidDimalanta: Exactly. When I wrote this one year ago, 3.5.2 was the latest version. I am currently not working with Unity3d anymore and therefore can not say anything about a newer version. – sunadorer Jun 16 '13 at 16:40
  • @Youngjae: The second link to the forum includes all needed steps, too. The first link contained the official instruction. It seems they completely removed it from the Unity page anymore. I can't tell if this means the Integration is not possible anymore in this way. – sunadorer Jun 16 '13 at 16:44
  • 1
    @sunadorer // Yes. I just want to clarify for readers of your valuable answer :) – Youngjae Jun 16 '13 at 18:40
  • I now took the time to update the answer to clarify that more. Thanks for your input. – sunadorer Jun 24 '13 at 10:08
1

I'm facing same thing. found that some more qcar related stuff is needed on top of unity project integration. it's mainly linking Qcar libraries and modifying manifest activities. have a look here https://ar.qualcomm.at/arforums/showthread.php?t=1243

However not helping to me much. still getting same error. a bit stuck with it.

stan
  • 11
  • 1
0

There is another page on SO asking this question. They claim to have obtained an answer on the qualcomm forums, different from the one above: Unable to find QCARWrapper

Community
  • 1
  • 1
ThomasW
  • 16,981
  • 4
  • 79
  • 106