Error build Android (Defold 1.2.172)

Hi! I used the new version of Defold to open my old project, it has no dependencies. I get this error when building for Android:

Unknown source:
contextResource cannot be null.

If you make an Android bundle with bob.jar directly it might give you a more specific error printed to the console.

I vaguely remember this error happening once in one of our projects but never posted about it. Sometimes to find weird problems like this we make a copy of a project and strip parts out, then try to bundle again, and repeat until it works to narrow down the problem.

1 Like

It originates from this line of code:

From here:

Are you using an app manifest to reduce the engine size?

Thank you for your answer, Yes I use app manifest, but it doesn’t seem to be the case. I still get this error. Maybe I should create a new project and add all the resources again

You could try that but I’d like to understand why you got the error in the first place. If you are able to share the project with me (bjorn@defold.se) I can take a look as well.

I sent the project to you. Tell me if you find a problem, thank you

1 Like

Just to add to the case, i’m having the same problem bundling the extension https://github.com/defold/extension-admob/ for android.

Do you have any more info about your troubles? Any build logs or errors?

Yes, the admob extension is to blame. Its owner asks you to pay in patreon. I just removed this extension and now use unity ads, which is much better than admob. Now everything is fine

Note that this was the defold extension, which admittedly hasn’t gotten much love or attention. However, we’d still like to be able to build it properly.

Hi Mathias, i just downloaded the project from https://github.com/defold/extension-admob/ and tried building it targeting Android Apk.
The building process stop wit this is error “contextResource cannot be null.”
If i can help in other ways just tell me.

Thank you

As suggested in a post of this thread, i tried building the project with bob.jar from command line, this is the exception stacktrace:
C:\Dev\Common\Defold-x86_64-win32\Defold_Workspace\admob_test>“C:\Program Files\Java\jdk-14.0.2+12\bin\java.exe” -jar bob.jar --archive --platform armv7-android resolve distclean build bundle
2147483647% 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% 99%Exception in thread “main” com.dynamo.bob.CompileExceptionError: contextResource cannot be null.
at com.dynamo.bob.Project.build(Project.java:452)
at com.dynamo.bob.Bob.main(Bob.java:621)
Caused by: java.lang.IllegalArgumentException: contextResource cannot be null.
at com.dynamo.bob.MultipleCompileException.attachLog(MultipleCompileException.java:88)
at com.dynamo.bob.bundle.BundleHelper.buildEngineRemote(BundleHelper.java:1145)
at com.dynamo.bob.Project.buildEngine(Project.java:715)
at com.dynamo.bob.Project.doBuild(Project.java:836)
at com.dynamo.bob.Project.build(Project.java:442)

So is there a fix for this or do we just have to pay this guy so I can update my app. Aside from changing to Unity.

The extension discussed in this thread is ancient and has never really been used in production. It was one of the first extensions ever created to test the feature. @sergey.lerg created a proper AdMob extension a long time ago. At first it was rev-share and recently change to paid access. The old rev-share version is still available:

Another alternative is to use Enhance to inject AdMob into your APK: https://defold.com/assets/enhance/

Or switch to UnityAds: https://defold.com/assets/defvideoads/

A final option would be to fix up the extension discussed in this thread, but that’s probably the most difficult if you haven’t worked with extensions before.

3 Likes