Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. We are looking for feedback on the naming of a new user research platform that we are working on.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Integration Unity as a library in native Android app

Discussion in '2019.3 Beta' started by PavelLU, May 27, 2019.

  1. ArpitTyagi01

    ArpitTyagi01

    Joined:
    Feb 21, 2018
    Posts:
    14
    Hello i am getting an issue with this as not able to detect plane and the point cloud is also stuck with the camera .
    Just opened the project mention here
    Any help ?
     
  2. shashkes

    shashkes

    Joined:
    Mar 16, 2017
    Posts:
    19
    you just saved me! thanks so much!!!
     
  3. sanjeev_raj29

    sanjeev_raj29

    Joined:
    Aug 18, 2019
    Posts:
    1
    I have Using Unity 2019.3.7f1

    Please help me..

    Error
    --------- beginning of crash
    2020-05-27 22:01:23.699 20249-20249/pw.sanjeev.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
    Process: pw.sanjeev.myapplication, PID: 20249
    java.lang.RuntimeException: Unable to start activity ComponentInfo{pw.sanjeev.myapplication/com.unity3d.player.UnityPlayerActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3119)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6864)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
    Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
    at android.content.res.Resources.getText(Resources.java:360)
    at android.content.res.MiuiResources.getText(MiuiResources.java:97)
    at android.content.res.Resources.getString(Resources.java:453)
    at com.unity3d.player.UnityPlayer.GetGlViewContentDescription(Unknown Source:20)
    at com.unity3d.player.UnityPlayer.<init>(Unknown Source:208)
    at com.unity3d.player.UnityPlayerActivity.onCreate(UnityPlayerActivity.java:41)
    at android.app.Activity.performCreate(Activity.java:7232)
    at android.app.Activity.performCreate(Activity.java:7221)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2964)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3119)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6864)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
    2020-05-27 22:01:23.721 20249-20249/pw.sanjeev.myapplication I/Process: Sending signal. PID: 20249 SIG: 9
     
  4. aasdfi

    aasdfi

    Joined:
    Jul 2, 2020
    Posts:
    1
  5. rco-tm

    rco-tm

    Joined:
    Mar 26, 2019
    Posts:
    1
    I'm curious if you have you been able to resolve this issue? I'm having the same behavior when ending the activity on Android = application exits. I need to be able to run Unity multiple times within the same app session - so attempting to close and reopen (or hide/pause and unhide/unpause).
     
    TealRB likes this.
  6. todd85

    todd85

    Joined:
    Oct 13, 2014
    Posts:
    3
    Hi, I followed the steps and the unityLibrary is added. But when I build the project
    I got an error : Dependent features configured but no package ID was set.
    Please help.
     
  7. suellasun

    suellasun

    Joined:
    Jul 27, 2020
    Posts:
    1
    Hi, I have the same problem, how did you resolve it?
     
  8. almog-holoarch

    almog-holoarch

    Joined:
    Aug 10, 2020
    Posts:
    1
    hello,
    is it possible to load the unity to a small fragment/frame inside the native android app instead of the current full screen activity ?
     
  9. rachitanurag

    rachitanurag

    Joined:
    Apr 8, 2020
    Posts:
    3
    Yes, it is possible to load inside a fragment and we can define the size of the fragment as well.
    You check out my tutorial as here I've used the fragment to insert the unity view. Currently in the sample it is a full screen fragment, however I'm sure you can easily modify the size of the fragment in the UnityFragment.kt
     
  10. rachitanurag

    rachitanurag

    Joined:
    Apr 8, 2020
    Posts:
    3
    Hello Everyone,

    I've created a tutorial which might help anyone how is looking to integrate unity into android. I'm embedding the unity view in a fragment so that the fragment can be used anywhere in Android. Another advantage I found of using the fragment is that native android controls can also be easily placed on top of the unity view, so that we can properly mix both of them together. Also on the Android side I've used Kotlin.
    This tutorial is also having the two way communication between the Android and Unity.
    The tutorial is following a step by step procedure based on Unity's on own post of using Unity as a library in Android.
    If you've any concerns or comments, please do let me know about it.
     
  11. QuillsInteractive

    QuillsInteractive

    Joined:
    Oct 29, 2017
    Posts:
    2
    Hi,

    Project has a requirement of having Unity3D Library to be exported and used inside Android Native. All working fine now until I tried to have Agora Plugin to be integrated inside Unity3D and exported the project as Library. I am seeing

    settings.gradle is having : implementation project('AgoraRtcEngineKit.plugin') in it.

    I can also see a Folder of androidBuild/unityLibrary/AgoraRtcEngineKit.plugin


    But I get the Compiler error on Gradle sync : Project with path ':unityLibrary\AgoraRtcEngineKit.plugin' could not be found in project ':app'.

    I moved the Plugins folder to the Assets Root folder, even then same issue( to have it like Assets/Plugins/Android/AgoraRtcEngineKit.plugin )

    note : I am using Unity3d.2019.4.7 LTS and Android Studio 4.0.1

    Please help me out, tried a lot on this
     
unityunity