Strange NullPointerException

39 views
Skip to first unread message

Sander Jochems

unread,
May 12, 2018, 4:26:59 PM5/12/18
to App Inventor Open Source Development
Hello,

I was creating a new component and everything was fine, but now I get this error. Why does this happen and how can I fix this? This happens in the build server when I am trying to build an APK.

     [java] java.lang.NullPointerException
     
[java]     at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
     
[java]     at com.google.common.io.Resources$UrlByteSource.<init>(Resources.java:77)
     
[java]     at com.google.common.io.Resources$UrlByteSource.<init>(Resources.java:72)
     
[java]     at com.google.common.io.Resources.asByteSource(Resources.java:66)
     
[java]     at com.google.common.io.Resources.newInputStreamSupplier(Resources.java:57)
     
[java]     at com.google.appinventor.buildserver.Compiler.getResource(Compiler.java:1992)
     
[java]     at com.google.appinventor.buildserver.Compiler.generateClasses(Compiler.java:1338)
     
[java]     at com.google.appinventor.buildserver.Compiler.compile(Compiler.java:1030)
     
[java]     at com.google.appinventor.buildserver.ProjectBuilder.build(ProjectBuilder.java:171)
     
[java]     at com.google.appinventor.buildserver.BuildServer.build(BuildServer.java:584)
     
[java]     at com.google.appinventor.buildserver.BuildServer.buildAndCreateZip(BuildServer.java:539)
     
[java]     at com.google.appinventor.buildserver.BuildServer.access$300(BuildServer.java:66)
     
[java]     at com.google.appinventor.buildserver.BuildServer$1.run(BuildServer.java:478)
     
[java]     at com.google.appinventor.buildserver.NonQueuingExecutor$1.run(NonQueuingExecutor.java:52)
     
[java]     at java.lang.Thread.run(Thread.java:748)

Thanks,
Sander

Tomislav Tomšić

unread,
May 12, 2018, 5:54:07 PM5/12/18
to App Inventor Open Source Development
Here is a good discussion what is java null pointer exception, why it occurs and how to solve it: https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it

Without knowing more details, I would guess that somewhere in your code, you initiated variable with a null, and then passed it/referenced it, without checking for appropriate value, which will then, predictably, return a null pointer exception.

Sander Jochems

unread,
May 12, 2018, 5:57:44 PM5/12/18
to App Inventor Open Source Development
Why does that happen in the Compiler?! If there was somrthing wrong in my code, then it would be in de ant build part or when I open the app. I dont understand this

Tomislav Tomšić

unread,
May 12, 2018, 7:13:27 PM5/12/18
to App Inventor Open Source Development
Probably it just cascades from your code, "down" to compiler, where it finally can not accept/propagate a null as a valid value any more. As I see from your log, initialization of resources might be a problem.

Maybe one of the libraries can not be loaded? Maybe objects in your library(ies) depend on some other library that isn't accessible to your component? Finally, have you checked all xml files, are all your libraries or other resources properly named? You know the drill, version and subversion numbers must correspond exactly etc. I do hope it is something like that.


Dana subota, 12. svibnja 2018. u 22:26:59 UTC+2, korisnik Sander Jochems napisao je:

Sander Jochems

unread,
May 13, 2018, 8:27:01 AM5/13/18
to App Inventor Open Source Development
So. I have no idea what it is. If someone could give me some things to look at that would be great

Evan W. Patton

unread,
May 13, 2018, 8:51:06 AM5/13/18
to app-inventor-o...@googlegroups.com
Given that it is in the code to extract resources from the build server jar, and given that it is happening in generateClasses, my first guess would be a misspelled jar file in a @UsesLibraries annotation. 

Evan

On May 13, 2018, at 08:27, Sander Jochems <sander54...@gmail.com> wrote:

So. I have no idea what it is. If someone could give me some things to look at that would be great

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to app-inventor-open-so...@googlegroups.com.
To post to this group, send email to app-inventor-o...@googlegroups.com.
Visit this group at https://groups.google.com/group/app-inventor-open-source-dev.
For more options, visit https://groups.google.com/d/optout.

Sander Jochems

unread,
May 13, 2018, 8:53:13 AM5/13/18
to App Inventor Open Source Development
Thanks for the help, give me 3 minutes to build the sources and check whether my component works

Sander Jochems

unread,
May 13, 2018, 8:58:51 AM5/13/18
to App Inventor Open Source Development
The APK built and then after I installed it works well

Thanks!
Reply all
Reply to author
Forward
0 new messages