codenameone / CameraKitCodenameOne

A cross platform API for low level camera access
3 stars 5 forks source link

Codenameone_settings.properties generate NullPointerException #11

Closed masartbenji closed 3 years ago

masartbenji commented 3 years ago

Hello,

Actually I'm not really sure if my issues is in the best place, just because it concern camerakit, codenameone migration tool and codenameone build procedure.

In my project, your migration tool create 2 submodule, first named commons contains all my code for the app, contains too the file "codenameone_settings.properties", the second submodule named cn1libs who contains differents files for the library I used during my development.

My actual problem is if I try to launch the app on simulator in actual state of the project, I'm not able to launch it. It's probably caused because the file "codenameone_settings.properties" is not in the root of the project. If I move manually the file to the root it launch in simulator but I have another problem to launch a build on your server.

When I take a look on my dashboard, I can see the build failed with a log report, really long, with 15.000 line, It's a bit unclear to know from where the error come from.

Best regards.

Nicolas Hubert

shannah commented 3 years ago

The codenameone_settings.properties should be in the common directory. See https://shannah.github.io/cn1-maven-archetypes/cn1app-archetype-tutorial/getting-started.html#_project_structure

You haven't included any error messages related to your project not running, so I can't comment further.

masartbenji commented 3 years ago

Hello,

Ok I reset the location of the codenameone_settings.properties but now when I try to launch my app in simulator I receive this error: java.lang.NullPointerException at com.codename1.camerakit.CameraKit.create(CameraKit.java:31) at com.adibox.adiscan_appmobile.adiscan_appmobile.start(adiscan_appmobile.java:132) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.codename1.impl.javase.Executor$4$1.run(Executor.java:314) at com.codename1.ui.Display.processSerialCalls(Display.java:1368) at com.codename1.ui.Display.mainEDTLoop(Display.java:1155) at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120) at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

When I follow the flow of the code to localize the error I can see CameraKit is not able to find build hint because it looking for it in the root of the project but my codenameone_settings.properties is in the module "Common" and not in the root

Best regards

Nicolas Hubert.

shannah commented 3 years ago

The cwd will be in the "common" directory, so it will be looking for the codenameone_settings.properties in the common dir. This error means that it can't find it.

After restoring the codenameone_settings.properties to its original location in the common dir, try a clean build. E.g. mvn clean

masartbenji commented 3 years ago

Hello,

Even after mvn clean on each module of the project and restore the location of codenameone_settings.properties, I receive the error. Actually my project structure is like this:

image

Best regards

Nicolas Hubert

shannah commented 3 years ago

This is fixed with Codename One 7.0.32 which I just pushed to Maven central. You'll need to update your cn1.version and cn1.plugin.version properties in the pom.xml file to be 7.0.32

It will take a few hours for Maven central to make this available.