question

ipicnic avatar image
ipicnic asked

Unity IAP plug-in: Class not found com.amazon.AmazonIAPPlugin

I'm trying to use the Unity plug-in for IAP. I install everything in place, but i'm getting this error in adb logcat. Exception: java.lang.ClassNotFoundException: com.amazon.AmazonIAPPlugin I/Unity (28638): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJavaObject._CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJavaObject.CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in :0 I/Unity (28638): at UnityEngine.AndroidJavaClass..ctor (System.String className) [0x00000] in :0 I/Unity (28638): at AmazonIAP..cctor () [0x00024] in /Users/victor/Desktop/pluginsTest/Assets/Plugins/AmazonIAPAndroid it says that can found the classe. What I should do now?
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Ipicnic, There is a sample app bundled with the unity plugin for IAP. Can you please run that first to check whether this issue is reproduced or not?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ipicnic avatar image
ipicnic answered
I've done that and I got the same error in abd logcat.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

matmideveloper avatar image
matmideveloper answered
I am also receiving this error. Using Unity 4.3.1f1. Can confirm the problem is when AmazonIAP.cs attempts to reference AmazonIAPPlugin.jar: using( var pluginClass = new AndroidJavaClass( "com.amazon.AmazonIAPPlugin" ) ) _plugin = pluginClass.CallStatic ( "instance" );
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ipicnic avatar image
ipicnic answered
I'm getting this error in Unity 4.2.2f1
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hello ipicnic and matmideveloper, We have attempted to reproduce the problems that you are describing with getting a java.lang.classnotfoundexception for com.amazon.IAPPlugin.class on both of your respective versions of Unity on Mac OS X and am unable to reproduce the problem. I was able to get the plugin(version 1.1.0) dropped into an empty Unity project, build for Android and I was able to log in, make item data requests, and initialize a purchase request using our SDKTester. This class is defined within the AmazonIABPlugin.jar file that is a part of our plugin. As discussed in the Unity manual for Android plugins, this jar file has to be located in Assets->Plugins->Android , otherwise Unity will not be able to invoke the JNI code that you guys are referring to correctly. For reference, please refer to : http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi, We are able to reproduce the problem while using java 7 tool chain. It seems to be working with JDK 1.6. We are following up with the concerned team to fix the issue. In the meantime, we have uploaded the old working version of the plugin in the below path to unblock the devs http://d20osnoojuwey9.cloudfront.net/unity/Amazon_IAP_Unity_Plugin.zip Thanks for bringing this issue to our notice. Message was edited by: Sujoy@Amazon
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ipicnic avatar image
ipicnic answered
Thank you for the answer. I'll wait for the final release!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

matmideveloper avatar image
matmideveloper answered
The plugin you have posted there does indeed work. No error messages now. Thanks for the help.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lotti1299 avatar image
lotti1299 answered
i think that the problem with the new unity package for unity is that this file "in-app-purchasing-1.0.3.jar" is missing
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Willem Kokke avatar image
Willem Kokke answered
I have the same issue. OSX Mavericks No java 7. willemkokke$ java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) If I add the in-app-purchasing-1.0.3.jar from the older version that's posted earlier, the error goes away, however other than the OnSdkAvailable event no callbacks are triggered. AmazonSDKTester does receive all the request and replies, but the unmodified test app does not call the Event Handlers. The older version does work, so I'll be using that for now, but hopefully this helps to narrow down what causes it so I can use the latest version.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.