Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
Embedded proguard.txt file to AAR library which should get rid of Cla…
Browse files Browse the repository at this point in the history
…ssNotFoundExceptions automatically
  • Loading branch information
yasirkula committed Apr 12, 2021
1 parent 559bb87 commit 3776f3d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/AAR Source (Android)/proguard.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class com.yasirkula.unity.* { *; }
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ After building your project, verify that NativeShare's `<provider ... />` 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

Expand Down
Binary file modified Plugins/NativeShare/Android/NativeShare.aar
Binary file not shown.
15 changes: 2 additions & 13 deletions Plugins/NativeShare/Editor/NSPostProcessBuild.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeShare/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<provider ... />" tag is inserted in-between the "<application>...</application>" 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:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 3776f3d

Please sign in to comment.