2
votes

Dev Platform: Mac OSX IDE: NetBeans Targeted Device: Android Topic: Build Server Issues

Details:

I resurrected an old CN1 project that I last sent to the build server ~2 years ago. I have spent a good amount of time doing extensive refactoring and it works great on the simulator. Note that the app uses a custom cn1lib, where I have a fair amount of code. The simulator seems good with this.

However, when I try to "send Android build" to the build server, it gets a java.lang.NullPointerException. Just to make sure that my Android certs were correct, I sent your "KitchenSink" demo to the build server and all worked well. But no good with my app. I'm not sure what to do from here. Any suggestions?

The exception on my app, when sent to the build server looks like this:

java.lang.NullPointerException at com.codename1.build.client.CodeNameOneBuildTask.execute(CodeNameOneBuildTask.java:330) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405) at org.apache.tools.ant.Project.executeTarget(Project.java:1376) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1260) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) BUILD FAILED (total time: 2 seconds)

The error also references this section of the build.xml file:

<target name="build-for-android-device" depends="clean,copy-android-override,copy-libs,jar,clean-override">
    <codeNameOne 
        jarFile="${dist.jar}"
        displayName="${codename1.displayName}"
        packageName = "${codename1.packageName}"
        mainClassName = "${codename1.mainName}"
        version="${codename1.version}"
        icon="${codename1.icon}"
        vendor="${codename1.vendor}"
        subtitle="${codename1.secondaryTitle}"

        targetType="android"
        keystoreAlias="${codename1.android.keystoreAlias}"
        keystore="${codename1.android.keystore}"
        certPassword="${codename1.android.keystorePassword}"
        automated="${automated}"
        />
</target>

Thanks in advance for any help.

2

2 Answers

1
votes

Okay, I resolved the problem. It seems that I had some obsolete cn1lib files in my lib directory. These I had later consolidated into a single cn1lib file. I suspect that they were conflicting.

All seems good now. Sorry for the false alarm!

0
votes

(Initial problem was solved, I'm posting here just for anyone who may suffer from similar problem.)

I recently encountered the same error message on Windows - Eclipse Oxygen - CN4.0

build.xml:287: java.lang.NullPointerException
    at com.codename1.build.client.CodeNameOneBuildTask.execute(CodeNameOneBuildTask.java:337)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor192.invoke(Unknown Source)
...
...

In my case it turns out that the icon file was not 512x512. Replacing the icon with another .png solved the problem. Debug message provided doesn't tell much about the cause, so it's like a trial and error.


Edit: Another symptom was failure to CN1 settings -> Basics if the icon was damaged