Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    2
    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
     
  12. Pequeno

    Pequeno

    Joined:
    Nov 13, 2012
    Posts:
    32
    I currently have issues with this, while trying to implement it together with Xamarin.

    It seems Unity is closing the whole activity at almost random times. The app works fine, until I open a UnityPlayer and render it. If I navigate away from the UnityPlayer view, it seems Unity 'finishes' the app completely, which it really shouldn't be doing when it's being used as a library. Anyone else seen this before, and know how to tell Unity to stop doing that?
     
  13. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    60
    ROBYER1 likes this.
  14. muratoter

    muratoter

    Joined:
    Aug 5, 2021
    Posts:
    2
    How we resolve 150mb aab file limitation? Can we use dynamic feature module for unityLibrary and launcher modules?
     
  15. vaibhavTrigensoft

    vaibhavTrigensoft

    Joined:
    Nov 15, 2021
    Posts:
    10
    Could not find :arcore_client:. Required by: project :app > project :unityLibrary any solution on this error..
     
  16. vaibhavTrigensoft

    vaibhavTrigensoft

    Joined:
    Nov 15, 2021
    Posts:
    10
    video player not working in android studio when project exported from unity to android studio
    unity version 2020.3.31f1 LTS