Shanaka R
Shanaka R

Reputation: 101

Issue with GearVR development after exporting as Google Android Project

I'm new to Unity development. So, I would like to say sorry if my question is worthless for a thread.

I started learning to develop an application in Unity for GearVR. In my scenario, I want to export Unity app as Google Android Project to Eclipse for further development. In Eclipse, I pass a message to a function in Unity through Sendmessage().

My first step was to develop the application and running in Note4 without enabling "Virtual Reality Support". It worked fine.

However, later I enabled "Virtual Reality Support" and export as a Google Android Project. Then, tried to install and run the application through Eclipse. But app crashed. Errors I was able to find in LogCat were "Fatal signal 11 (SIGSEGV) at 0xfa57132b (code=1), thread 9384 (UnityMain)" and "Unable to find OVRPlugin".

Then, I used "Build and Run" in Unity to install the app to Note4. This time, it worked fine.

So, app doesn't work when "Virtual Reality Support" is enabled and install through Eclipse after exporting it as a Google Android Project.

I reverse engineered the apk created by Unity when I used "Build and Run". I noticed some differences in exported Google Android Project and Reverse Engineered apk Projects. Specially, contents in libs folder were different.

It would be great if anyone can help me to solve this issue.

Upvotes: 4

Views: 537

Answers (1)

jakub.sz
jakub.sz

Reputation: 63

I've encountered the same problem and here is what eventually worked for me:

1) Export Android project with "Virtual Reality Support" enabled.

2) Open Android Studio and use Import project (Eclipse ADT, Gradle, etc.) to import your project. Choose another directory for "Import Destination". Select all three options on next screen.

3) Wait until import and Gradle's work is done.

4) Exit project or Android Studio.

5) Copy ovrplugin.aar file from Unity generated project directory (project_name/libs/ovrplugin.aar) to Android Studio generated project (project_name/app/libs/)

6) Edit build.gradle file located at project_name/app/ and add this:

allprojects {
  repositories {
    jcenter()
    flatDir {
      dirs 'libs'
    }
  }
}

and also this: compile(name:'ovrplugin', ext:'aar') in dependencies {} section

so this file looks something like this:

apply plugin: 'com.android.application'

android {
    (...)
}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

dependencies {
    compile(name:'ovrplugin', ext:'aar')
    (...)
}

7) Open your project and wait until Gradle finishes processing updated files.

Now this should work fine. Build APK and test.

Upvotes: 1

Related Questions