Search code examples
javamavenerror-handlingcodenameoneproguard

Codename one java ios app PROGUARD warnings trouble


I'm writing IOS app using codename one project that I get from codename`s initializer cite. At some point I have to use java.net, java.io and java.util packages. But when I'm trying to build project, following warnings occurs:

enter image description here

"[INFO] ProGuard, version 7.2.0-beta2 [INFO] Reading input... [INFO] Reading program jar [C:\Users\Kor\IdeaProjects\testapp\common\target\compliance-check.jar] (filtered) [INFO] Reading library jar [C:\Users\Kor.m2\repository\com\codenameone\java-runtime\7.0.86\java-runtime-7.0.86.jar] (filtered) [INFO] Reading library jar [C:\Users\Kor.m2\repository\com\codenameone\codenameone-core\7.0.117\codenameone-core-7.0.117.jar] (filtered) [INFO] Initializing... [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URL [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URLConnection [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.util.Scanner [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URL [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URL [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URLConnection [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.util.Scanner [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.util.Scanner [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.util.Scanner [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.net.URLConnection [INFO] Warning: com.kor.testiosapp.forms.ResultsForm: can't find referenced class java.util.Scanner [INFO] Warning: there were 11 unresolved references to classes or interfaces. [INFO] You may need to add missing library jars or update their versions. [INFO] If your code works fine without the missing classes, you can suppress [INFO] the warnings with '-dontwarn' options. [INFO] (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass) [INFO] java.io.IOException: Please correct the above warnings first."

The manual to which link leads has brief description of problem cause and it's solution. But I even can't find proguard config file to put necessary options. I guess that config file lays somewhere in codename one libs and that`s the reason I can't find it.

I also read this part of manual: " For example, if ProGuard complains that it can't find a java.lang class, you have to make sure that you are specifying the run-time library of your platform. For JSE, these are typically packaged in lib/rt.jar (vm.jar for IBM's JVM, and classes.jar in MacOS X) or as of Java 9, jmods/java.base.jmod."

But that didn't help me either, as I don't understand the point of the "make sure that you are specifying the run-time library of your platform" part.


Solution

  • This error is there to indicate that you are using classes that are unsupported by the Codename One API such as Scanner. You can review the supported classes in the JavaDoc here.

    Classes like Scanner are mostly about user command line input which isn't relevant when running on a device.