Skip to content

Commit 1d3905c

Browse files
authored
Android JNI module is now optional (#100)
1 parent 137dd36 commit 1d3905c

4 files changed

Lines changed: 30 additions & 8 deletions

File tree

Plugins/IngameDebugConsole/Android/DebugLogLogcatListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if UNITY_EDITOR || UNITY_ANDROID
1+
#if (UNITY_EDITOR || UNITY_ANDROID) && UNITY_ANDROID_JNI
22
using System.Collections.Generic;
33
using UnityEngine;
44

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
{
1+
{
22
"name": "IngameDebugConsole.Runtime",
3+
"rootNamespace": "",
34
"references": [
45
"Unity.InputSystem"
5-
]
6+
],
7+
"includePlatforms": [],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": true,
13+
"defineConstraints": [],
14+
"versionDefines": [
15+
{
16+
"name": "com.unity.modules.androidjni",
17+
"expression": "",
18+
"define": "UNITY_ANDROID_JNI"
19+
}
20+
],
21+
"noEngineReferences": false
622
}

Plugins/IngameDebugConsole/Scripts/DebugLogItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class DebugLogItem : MonoBehaviour, IPointerClickHandler
1414
{
1515
#region Platform Specific Elements
1616
#if !UNITY_2018_1_OR_NEWER
17-
#if !UNITY_EDITOR && UNITY_ANDROID
17+
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
1818
private static AndroidJavaClass m_ajc = null;
1919
private static AndroidJavaClass AJC
2020
{

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public bool PopupEnabled
439439
private bool isQuittingApplication;
440440
#endif
441441

442-
#if !UNITY_EDITOR && UNITY_ANDROID
442+
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
443443
private DebugLogLogcatListener logcatListener;
444444
#endif
445445

@@ -601,11 +601,17 @@ private void OnEnable()
601601

602602
if( receiveLogcatLogsInAndroid )
603603
{
604-
#if !UNITY_EDITOR && UNITY_ANDROID
604+
#if UNITY_ANDROID
605+
#if UNITY_ANDROID_JNI
606+
#if !UNITY_EDITOR
605607
if( logcatListener == null )
606608
logcatListener = new DebugLogLogcatListener();
607609

608610
logcatListener.Start( logcatArguments );
611+
#endif
612+
#else
613+
Debug.LogWarning( "Android JNI module must be enabled in Package Manager for \"Receive Logcat Logs In Android\" to work." );
614+
#endif
609615
#endif
610616
}
611617

@@ -634,7 +640,7 @@ private void OnDisable()
634640
if( !receiveLogsWhileInactive )
635641
Application.logMessageReceivedThreaded -= ReceivedLog;
636642

637-
#if !UNITY_EDITOR && UNITY_ANDROID
643+
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
638644
if( logcatListener != null )
639645
logcatListener.Stop();
640646
#endif
@@ -717,7 +723,7 @@ private void Update()
717723
lastFrameCount = Time.frameCount;
718724
#endif
719725

720-
#if !UNITY_EDITOR && UNITY_ANDROID
726+
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
721727
if( logcatListener != null )
722728
{
723729
string log;

0 commit comments

Comments
 (0)