Codenameone in-app purchase for J2me

Tag: java-me , codenameone Author: xiaocuiwk Date: 2014-04-07

I have implemented one app for s40 (Asha) using CodenameOne SDK, I want to implement In app Purchase for it (Nokia S40) but when I use Nokia_in-app_payment library and compile it so it give error below is mentioned error, could anybody please tell me how can I do it. Thanks in advance.

/*
**Executing: javac -source 5 -target 1.5 -classpath /tmp/build1853819559696327916xxx/tmpclasses:/home/ec2-user/j2me/midpapis.jar -d /tmp/build1853819559696327916xxx/tmpclasses /tmp/build1853819559696327916xxx/tmpsrc/MinerwaStub.java warning: [options] bootstrap class path not set in conjunction with -source 1.5
Note: /tmp/build1853819559696327916xxx/tmpsrc/MinerwaStub.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
Executing: java -jar /home/ec2-user/j2me/proguard.jar -injars . -libraryjars /home/ec2-user/j2me/midpapis.jar:/home/ec2-user/j2me/CLDC11.jar -outjars /tmp/build1853819559696327916xxx/result/Minerwa.jar -target 1.3 -keep public class ** extends javax.microedition.midlet.MIDlet { public *; } -defaultpackage '' -printmapping /tmp/build1853819559696327916xxx/result/obfuscation_mapping.txt -overloadaggressively -dontusemixedcaseclassnames -useuniqueclassmembernames -dontoptimize ProGuard, version 4.7
Reading program directory [/tmp/build1853819559696327916xxx/tmpclasses]
Reading library jar [/home/ec2-user/j2me/midpapis.jar]
Reading library jar [/home/ec2-user/j2me/CLDC11.jar]
Note: duplicate definition of library class [java.io.ByteArrayInputStream]
Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: duplicate definition of library class [java.io.DataInput]
Note: duplicate definition of library class [java.io.DataInputStream]
Note: duplicate definition of library class [java.io.DataOutput]
Note: duplicate definition of library class [java.io.DataOutputStream]
Note: duplicate definition of library class [java.io.EOFException]
Note: duplicate definition of library class [java.io.IOException]
Note: duplicate definition of library class [java.io.InputStream]
Note: duplicate definition of library class [java.io.InputStreamReader]
Note: duplicate definition of library class [java.io.InterruptedIOException]
Note: duplicate definition of library class [java.io.OutputStream]
Note: duplicate definition of library class [java.io.OutputStreamWriter]
Note: duplicate definition of library class [java.io.PrintStream]
Note: duplicate definition of library class [java.io.Reader]
Note: duplicate definition of library class [java.io.UTFDataFormatException]
Note: duplicate definition of library class [java.io.UnsupportedEncodingException]
Note: duplicate definition of library class [java.io.Writer]
Note: duplicate definition of library class [java.lang.ArithmeticException]
Note: duplicate definition of library class [java.lang.ArrayIndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.ArrayStoreException]
Note: duplicate definition of library class [java.lang.Boolean]
Note: duplicate definition of library class [java.lang.Byte]
Note: duplicate definition of library class [java.lang.Character]
Note: duplicate definition of library class [java.lang.Class]
Note: duplicate definition of library class [java.lang.ClassCastException]
Note: duplicate definition of library class [java.lang.ClassNotFoundException]
Note: duplicate definition of library class [java.lang.Double]
Note: duplicate definition of library class [java.lang.Error]
Note: duplicate definition of library class [java.lang.Exception]
Note: duplicate definition of library class [java.lang.Float]
Note: duplicate definition of library class [java.lang.IllegalAccessException]
Note: duplicate definition of library class [java.lang.IllegalArgumentException]
Note: duplicate definition of library class [java.lang.IllegalMonitorStateException]
Note: duplicate definition of library class [java.lang.IllegalStateException]
Note: duplicate definition of library class [java.lang.IllegalThreadStateException]
Note: duplicate definition of library class [java.lang.IndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.InstantiationException]
Note: duplicate definition of library class [java.lang.Integer]
Note: duplicate definition of library class [java.lang.InterruptedException]
Note: duplicate definition of library class [java.lang.Long]
Note: duplicate definition of library class [java.lang.Math]
Note: duplicate definition of library class [java.lang.NegativeArraySizeException]
Note: duplicate definition of library class [java.lang.NoClassDefFoundError]
Note: duplicate definition of library class [java.lang.NullPointerException]
Note: duplicate definition of library class [java.lang.NumberFormatException]
Note: duplicate definition of library class [java.lang.Object]
Note: duplicate definition of library class [java.lang.OutOfMemoryError]
Note: duplicate definition of library class [java.lang.Runnable]
Note: duplicate definition of library class [java.lang.Runtime]
Note: duplicate definition of library class [java.lang.RuntimeException]
Note: duplicate definition of library class [java.lang.SecurityException]
Note: duplicate definition of library class [java.lang.Short]
Note: duplicate definition of library class [java.lang.String]
Note: duplicate definition of library class [java.lang.StringBuffer]
Note: duplicate definition of library class [java.lang.StringIndexOutOfBoundsException]
Note: duplicate definition of library class [java.lang.System]
Note: duplicate definition of library class [java.lang.Thread]
Note: duplicate definition of library class [java.lang.Throwable]
Note: duplicate definition of library class [java.lang.VirtualMachineError]
Note: duplicate definition of library class [java.lang.ref.Reference]
Note: duplicate definition of library class [java.lang.ref.WeakReference]
Note: duplicate definition of library class [java.util.Calendar]
Note: duplicate definition of library class [java.util.Date]
Note: duplicate definition of library class [java.util.EmptyStackException]
Note: duplicate definition of library class [java.util.Enumeration]
Note: duplicate definition of library class [java.util.Hashtable]
Note: duplicate definition of library class [java.util.NoSuchElementException]
Note: duplicate definition of library class [java.util.Random]
Note: duplicate definition of library class [java.util.Stack]
Note: duplicate definition of library class [java.util.TimeZone]
Note: duplicate definition of library class [java.util.Timer]
Note: duplicate definition of library class [java.util.TimerTask]
Note: duplicate definition of library class [java.util.Vector]
Note: there were 74 duplicate class definitions.
Warning: com.mobifusion.minerwa.HomePage: can't find superclass or interface com.nokia.payment.NPayListener
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.NPayListener
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.PurchaseData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.PurchaseData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.ProductData
Warning: com.mobifusion.minerwa.HomePage: can't find referenced class com.nokia.payment.ProductData
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.siemens.mp.game.Light
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.nokia.mid.ui.FullCanvas
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.mot.iden.util.Base64
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class mmpp.media.MediaPlayer
Note: there were 6 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
Warning: there were 6 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.** 
*/



Thanks,
Shailendra Gautam

Other Answer1

You will need to set the build argument j2me.obfuscation=false and obfuscate on your own with the Nokia libraries.