Skip to content

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 b502dd0 commit 68d2b2a
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 21 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 @@ -41,7 +41,7 @@ After building your project, verify that NativeCamera's `<provider ... />` tag i

- **Can't use the camera, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.NativeCamera" 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.* { *; }`

- **NativeCamera functions return Permission.Denied even though I've granted the permission"**

Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeCamera/Android/NCCallbackHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_EDITOR && UNITY_ANDROID
#if UNITY_EDITOR || UNITY_ANDROID
using UnityEngine;

namespace NativeCameraNamespace
Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeCamera/Android/NCCameraCallbackAndroid.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_EDITOR && UNITY_ANDROID
#if UNITY_EDITOR || UNITY_ANDROID
using UnityEngine;

namespace NativeCameraNamespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_EDITOR && UNITY_ANDROID
#if UNITY_EDITOR || UNITY_ANDROID
using System.Threading;
using UnityEngine;

Expand Down
Binary file modified Plugins/NativeCamera/Android/NativeCamera.aar
Binary file not shown.
15 changes: 2 additions & 13 deletions Plugins/NativeCamera/Editor/NCPostProcessBuild.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 @@ -15,17 +15,6 @@ public class NCPostProcessBuild
private const string CAMERA_USAGE_DESCRIPTION = "The app requires access to the camera to take pictures or record videos with it.";
private const string MICROPHONE_USAGE_DESCRIPTION = "The app will capture microphone input in the recorded video.";

[InitializeOnLoadMethod]
public static void ValidatePlugin()
{
string jarPath = "Assets/Plugins/NativeCamera/Android/NativeCamera.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/NativeCamera/NativeCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.IO;
using UnityEngine;
using Object = UnityEngine.Object;
#if !UNITY_EDITOR && ( UNITY_ANDROID || UNITY_IOS )
#if UNITY_ANDROID || UNITY_IOS
using NativeCameraNamespace;
#endif

Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeCamera/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ There are two ways to set up the plugin on iOS:
After building your project, verify that NativeCamera'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 use the camera, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.NativeCamera" 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
Please see the online documentation for a more in-depth documentation of the Scripting API: https://github.com/yasirkula/UnityNativeCamera
Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeCamera/iOS/NCCameraCallbackiOS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_EDITOR && UNITY_IOS
#if UNITY_EDITOR || UNITY_IOS
using UnityEngine;

namespace NativeCameraNamespace
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.nativecamera",
"displayName": "Native Camera",
"version": "1.2.7",
"version": "1.2.8",
"documentationUrl": "https://github.com/yasirkula/UnityNativeCamera",
"changelogUrl": "https://github.com/yasirkula/UnityNativeCamera/releases",
"licensesUrl": "https://github.com/yasirkula/UnityNativeCamera/blob/master/LICENSE.txt",
Expand Down

0 comments on commit 68d2b2a

Please sign in to comment.