java.lang.NullPointerException: Unknown (SOLVED)

#1

Ran into this error “java.lang.NullPointerException: Unknown” when bundling to iOS. Not sure what the issue is here…
06%20AM

This has been reported on github but any feedback would be appreciated.

0 Likes

#2

Does your project contain any extensions? Check if there is a log.txt in the build folder. Try running the editor from the commandline and check the console output. Any clues?

0 Likes

#3

The project contains the extensions defold-input as well as orthographic and builtins.

I’m not quite sure how to run the editor from the command line, what I did was opened the terminal on macOS and ran open -a defold and it opened up defold from there. Doing this there was nothing in the console

I looked in the build file and found a “default” file as well as “arm7-ios”, within these folders I did not find a log.txt. I might be looking in the wrong spot though.

Before this happened I duplicated my project file so I could make changes that I still had an old version of the project in case I decided to revert back to it. Thinking this might have been the issue, the duplicate project file has been moved to the trash. The error still persists.

I tried simply downloading platypus from github and bundled that and it worked fine so the issue must be related to something specific that I must have done…

Thank you for your help.

0 Likes

#4

Ok, so you had two files with .project extension?

I would suggest that you create a new empty project and copy the files of your project file by file or folder by folder to try and pinpoint what’s wrong.

If you want to you can also zip your project and share it here.

1 Like

#5

Yes, I had project folders with .project extensions but one of these folders has since been moved to trash. I tried to create an empty project and move the folders over but I still got the java error and I had trouble pinpointing the issue down to one folder or one file.
adventure game - multitouch platypus.zip (4.2 MB)

Here is the zip of the project, thank you so much for your help again.

0 Likes

#6

The project builds and runs just fine here. Can you try closing the editor, removing the “.internal” folder and the “build” folder, open the editor again and build?

Can you also try launching the editor a terminal and share the output in the terminal? You start Defold from the terminal like this:

$> /Applications/Defold.app/Contents/MacOS/Defold

And share the editor log: https://defold.com/manuals/getting-help/#editor-logs

0 Likes

#7

After removing the .internal and build folders the error still persisted. I tried uninstalling and reinstalling Defold but the error occured again. Here is the editor log:
editor log.txt (82.3 KB)
I skimmed through the log and I did find the java.lang.nulpointerexception error but I could not decode what it was trying to tell me haha.
Thanks again for your help!

0 Likes

#8

I’m honestly not sure what is wrong at this point. The project you shared is working for me, also on macOS. And you’re saying that an empty project is working for you?

I think you need to rebuild your game one step at a time and build and run in between to try and pin-point where it goes wrong.

0 Likes

#9

Alright, the last point you made is exactly what I did and realized that it was being caused by the onscreen.gui script. Whenever I removed this specific script the error went away and it build like normal… I have no idea why it is causing this error especially because it worked fine on your computer haha.
Maybe you have a bit of insight on this script and how to possibly avoid the error. Much thanks.
V

0 Likes

#10

Ok, can you share the project without that file and also share the file itself. How are you using it?

0 Likes

#11

I am using it very similarly to how the platypus example project is being used. It is linked to a gui that has controls for the character when used on mobile. In my project it is connected to the “mobile controls gui” in the “main” collection.
adventure game - multitouch platypus 3.zip (4.2 MB)
That is the game…
gui script.txt (598 Bytes)
And here is the script thanks so much for your help!
V

0 Likes

#12

In this script you do:

local onscreen = require ".onscreen"

I wonder if that dot ‘.’ causes problems. Can you please try without it?

Can I also ask why you aren’t using defold-input as a dependency? (ie add https://github.com/britzl/defold-input/archive/2.8.3.zip to game .project dependencies)

0 Likes

#13

AH IT WORKED! That is so strange and I would never have realized that could cause such an issue. You have come to the rescue yet again and I thank you much for it, I just with there was a way I could repay you for it.

As for the defold-input, I was using a much older version of it (0.9) but I have now switched over, thanks.

Thank you so much for all your help again, I with I could repay your time and help.
Have a great one.
V

0 Likes

#14

Tell people about Defold!

3 Likes

#15

Hello,

I have just started using Unity 3D to create a 2D games with my Son. while we compile our game to run a code we are getting an error java.lang.NullPointerException error. First I thought that I am using the older version of JRE or JDK and Unity due to my system which is old. But after the update it is still doing the same. For now I have uninstalled Unity from my system and will see if our project runs properly on the other system.

In any case if it doesn’t works, what should I do?

0 Likes

#16

It’s difficult to say without any more info (OS, repro steps, logs etc)
Here are some notes abut pinpointing the error:

0 Likes

#17

This is the support forum for the Defold game engine. You write that you are using Unity. Unity support forum is here: https://forum.unity.com/

2 Likes

#18

Oh Okay. Thanks

0 Likes

#19

Hello, I just encountered this same error and traced it back to a game object property I made for testing purposes.

The property contained “\\/” (2 back slashes, 1 forward slash) in its ID. Removing this property removed this error. The project would build and run without error, but packages could not be created.

Just sharing this in case someone else encounters this error.

3 Likes