Skip to content

Commit 4666cc7

Browse files
committed
- Fixed "Namespace 'com.yasirkula.unity' is used in multiple modules and/or libraries" error that is introduced with Android Gradle version 9.1.0 on Unity 6.4.4+ if multiple native plugins of mine are used at the same time: https://discussions.unity.com/t/info-android-gradle-9-1-0-agp-9-0-0-update-in-unity-6-4/1709062
- "AAR Source (Android)" folder is now an actual Android Studio Android Library module - Plugin's Gradle version had to be updated to 7.5.1 to fix this issue so make sure your Unity version is compatible: https://docs.unity3d.com/2021.3/Documentation/Manual/android-gradle-overview.html
1 parent 4cf7ce6 commit 4666cc7

16 files changed

Lines changed: 42 additions & 13 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

.github/AAR Source (Android)/AndroidManifest.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
plugins {
2+
id 'com.android.library'
3+
}
4+
5+
android {
6+
namespace = 'com.yasirkula.simplefilebrowser'
7+
compileSdk = 33
8+
9+
defaultConfig {
10+
minSdk = 19
11+
consumerProguardFiles "consumer-rules.pro"
12+
}
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
16+
}
17+
}
18+
19+
dependencies {
20+
}
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-keep class com.yasirkula.unity.* { *; }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
3+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="replace" />
4+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" />
5+
<application android:requestLegacyExternalStorage="true" />
6+
</manifest>

.github/AAR Source (Android)/java/com/yasirkula/unity/FileBrowser.java renamed to .github/AAR Source (Android)/src/main/java/com/yasirkula/unity/FileBrowser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static String GetExternalDrives( Context context )
108108
}
109109

110110
// This is the only working method on some Android 11+ devices (when Storage Access Framework isn't used)
111-
if( android.os.Build.VERSION.SDK_INT >= 30 )
111+
if( Build.VERSION.SDK_INT >= 30 )
112112
{
113113
for( StorageVolume volume : ( (StorageManager) context.getSystemService( Context.STORAGE_SERVICE ) ).getStorageVolumes() )
114114
{
@@ -117,7 +117,7 @@ public static String GetExternalDrives( Context context )
117117
potentialDrives.add( volumeDirectory.toString() );
118118
}
119119
}
120-
else if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N )
120+
else if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N )
121121
{
122122
try
123123
{
@@ -185,7 +185,7 @@ public static void RequestPermission( Context context, final FileBrowserPermissi
185185
// Returns whether or not Storage Access Framework (SAF) should be used
186186
public static boolean CheckSAF()
187187
{
188-
return android.os.Build.VERSION.SDK_INT >= 29 && !Environment.isExternalStorageLegacy();
188+
return Build.VERSION.SDK_INT >= 29 && !Environment.isExternalStorageLegacy();
189189
}
190190

191191
// Prompts the user to pick a Storage Access Framework (SAF) folder

.github/AAR Source (Android)/java/com/yasirkula/unity/FileBrowserDirectoryPickerFragment.java renamed to .github/AAR Source (Android)/src/main/java/com/yasirkula/unity/FileBrowserDirectoryPickerFragment.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.os.Build;
1010
import android.os.Bundle;
1111
import android.provider.DocumentsContract;
12-
import android.util.Log;
1312
import android.widget.Toast;
1413

1514
@TargetApi( Build.VERSION_CODES.Q )

.github/AAR Source (Android)/java/com/yasirkula/unity/FileBrowserDirectoryReceiver.java renamed to .github/AAR Source (Android)/src/main/java/com/yasirkula/unity/FileBrowserDirectoryReceiver.java

File renamed without changes.

.github/AAR Source (Android)/java/com/yasirkula/unity/FileBrowserPermissionFragment.java renamed to .github/AAR Source (Android)/src/main/java/com/yasirkula/unity/FileBrowserPermissionFragment.java

File renamed without changes.

0 commit comments

Comments
 (0)