From 3776f3d47e4ca0086c44c2c1b2beec6c2a8f8e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=BCleyman=20Yasir=20KULA?= Date: Mon, 12 Apr 2021 23:03:49 +0300 Subject: [PATCH] Embedded proguard.txt file to AAR library which should get rid of ClassNotFoundExceptions automatically --- .github/AAR Source (Android)/proguard.txt | 1 + .github/README.md | 2 +- Plugins/NativeShare/Android/NativeShare.aar | Bin 27180 -> 27358 bytes .../NativeShare/Editor/NSPostProcessBuild.cs | 15 ++------------- Plugins/NativeShare/README.txt | 2 +- package.json | 2 +- 6 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 .github/AAR Source (Android)/proguard.txt diff --git a/.github/AAR Source (Android)/proguard.txt b/.github/AAR Source (Android)/proguard.txt new file mode 100644 index 0000000..3ef89b8 --- /dev/null +++ b/.github/AAR Source (Android)/proguard.txt @@ -0,0 +1 @@ +-keep class com.yasirkula.unity.* { *; } \ No newline at end of file diff --git a/.github/README.md b/.github/README.md index 2410658..6406b6e 100644 --- a/.github/README.md +++ b/.github/README.md @@ -74,7 +74,7 @@ After building your project, verify that NativeShare's `` tag is - **Can't share, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.NativeShare" in Logcat** -If your project uses ProGuard, try adding the following line to ProGuard filters: `-keep class com.yasirkula.unity.* { *; }` +If you are sure that your plugin is up-to-date, then enable **Custom Proguard File** option from *Player Settings* and add the following line to that file: `-keep class com.yasirkula.unity.* { *; }` ## EXAMPLE CODE diff --git a/Plugins/NativeShare/Android/NativeShare.aar b/Plugins/NativeShare/Android/NativeShare.aar index 4ef854b01d8f150570b77170ba5a8148237137d5..4dd22eae9eb1e1d1e70e58f92a2c0bf3575b50d8 100644 GIT binary patch delta 212 zcmZ2;h4J21#tourLCh>73=9k$4CmJL1a-d)G0_6@G=P`~hzpAH(@PVJQuInHN-m%E z^VJRTIOnOO7v^#9{MFSyI_Gpw>7DhwqJ8$X&dMv7gI0uH*c7&cm0`1R8Y@c?Ba=J> zE|XP&W`lqN5DTZF+QS7FWnf@rkYMN$U&4M`|2iX#zHs)-n^Qo3fHx}}NIy3aCbBRv Kqyx=hU;qH*9z7iZ delta 35 lcmcb2m2u4##tourn={jxSwvXb7=VBa2$@+J7=+V6JOH=+2Au!^ diff --git a/Plugins/NativeShare/Editor/NSPostProcessBuild.cs b/Plugins/NativeShare/Editor/NSPostProcessBuild.cs index 6c9e344..081f299 100644 --- a/Plugins/NativeShare/Editor/NSPostProcessBuild.cs +++ b/Plugins/NativeShare/Editor/NSPostProcessBuild.cs @@ -1,7 +1,7 @@ -using System.IO; +#if UNITY_IOS +using System.IO; using UnityEditor; using UnityEngine; -#if UNITY_IOS using UnityEditor.Callbacks; using UnityEditor.iOS.Xcode; #endif @@ -13,17 +13,6 @@ public class NSPostProcessBuild private const bool ENABLED = true; private const string PHOTO_LIBRARY_USAGE_DESCRIPTION = "The app requires access to Photos to save media to it."; - [InitializeOnLoadMethod] - public static void ValidatePlugin() - { - string jarPath = "Assets/Plugins/NativeShare/Android/NativeShare.jar"; - if( File.Exists( jarPath ) ) - { - Debug.Log( "Deleting obsolete " + jarPath ); - AssetDatabase.DeleteAsset( jarPath ); - } - } - #if UNITY_IOS #pragma warning disable 0162 [PostProcessBuild] diff --git a/Plugins/NativeShare/README.txt b/Plugins/NativeShare/README.txt index b48be10..0e81aa6 100644 --- a/Plugins/NativeShare/README.txt +++ b/Plugins/NativeShare/README.txt @@ -35,7 +35,7 @@ It is just not possible to share an image/file with text/subject on some apps (e After building your project, verify that NativeShare's "" tag is inserted in-between the "..." tags of PROJECT_PATH/Temp/StagingArea/AndroidManifest.xml. If not, please contact me. - Can't share, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.NativeShare" in Logcat -If your project uses ProGuard, try adding the following line to ProGuard filters: -keep class com.yasirkula.unity.* { *; } +If you are sure that your plugin is up-to-date, then enable "Custom Proguard File" option from Player Settings and add the following line to that file: -keep class com.yasirkula.unity.* { *; } 4. SCRIPTING API Simply create a new NativeShare object and customize it by chaining the following functions as you like: diff --git a/package.json b/package.json index e40247b..b67112b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.yasirkula.nativeshare", "displayName": "Native Share", - "version": "1.3.10", + "version": "1.4.0", "documentationUrl": "https://github.com/yasirkula/UnityNativeShare", "changelogUrl": "https://github.com/yasirkula/UnityNativeShare/releases", "licensesUrl": "https://github.com/yasirkula/UnityNativeShare/blob/master/LICENSE.txt",