Problem with bouncy castle and android build

717 views
Skip to first unread message

torsten...@googlemail.com

unread,
Apr 28, 2016, 7:23:51 AM4/28/16
to CodenameOne Discussions
IDE: Eclipse
Desktop Windows 7
Simulator
Device  Android


Hi,

I've a problem with building my android app including bouncy castle.

I've put the file BouncyCastleCN1Lib.cn1lib in my lib directory.
After that I've started "CodenameOne -> Refresh Libs".
All worked fine and I can use the lib localy without any problems.
The app works fine in the simulator.

Now I've started "CodenameOne -> Send Android Build".
The build has been started correctly, but the build crashes with the following error:

...
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.engines.AESEngine
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.engines.AESEngine
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.params.KeyParameter
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.params.KeyParameter
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.DataLengthException
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.InvalidCipherTextException
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher
Warning: com.workflow.AES_BC: can't find referenced class org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher

...

Warning: there were 14 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:transformClassesAndResourcesWithProguardForRelease FAILED
:transformClassesAndResourcesWithProguardForRelease (Thread[Daemon worker,5,main]) completed. Took 5.445 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

...


Is there anything I've forgotten ? A setup or something like that ?

Thanks for your help!

kind regards,
Torsten


 





Shai Almog

unread,
Apr 29, 2016, 12:43:24 AM4/29/16
to CodenameOne Discussions, torsten...@googlemail.com
Did you change an old project to use Java 8 or is this a new project?
Can you post the full log?

torsten...@googlemail.com

unread,
Apr 29, 2016, 2:56:48 AM4/29/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,

I'm using Java 7. It's an older project but I'm added the crypto code now.
Attached you will find the complete error log.

kind regards,
Torsten
45dc2e6c-38bd-42fa-bd16-4a8ab9425ed3-1461841276087-error.txt

Shai Almog

unread,
Apr 30, 2016, 12:37:20 AM4/30/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,
try sending a build with the hint java.version=8 and see if it solves the issue.

torsten...@googlemail.com

unread,
May 2, 2016, 2:56:10 AM5/2/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,

that doesn't change anything.
I've attached the last error log.

kind regards,
Torsten
89de3637-c5d7-4b0d-9200-197941c5314b-1462171842218-error.txt

Shai Almog

unread,
May 3, 2016, 12:03:53 AM5/3/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,
this should work. Chen can you verify if this is an Eclipse issue?

Chen Fishbein

unread,
May 3, 2016, 3:35:53 AM5/3/16
to CodenameOne Discussions, torsten...@googlemail.com
This looks like a progaurd issue, try to build for debug and check if the build works.
If it does works, you can either add the keep options in the build hints or to disable proguard

torsten...@googlemail.com

unread,
May 3, 2016, 6:03:35 AM5/3/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,

I've disabled proguard and now all works fine.
Many thanks for your help.

kind regards,
Torsten

Shai Almog

unread,
May 4, 2016, 1:16:27 AM5/4/16
to CodenameOne Discussions, torsten...@googlemail.com
Hi,
that's mostly for debugging but I suggest not doing that in the long term. Are you using Class.forName() or passing a class name to an API?
I suggest using a class literal instead e.g. MyClass.class which will allow the obfuscator to work and produce better/smaller/faster code.
Reply all
Reply to author
Forward
0 new messages