Native extension doesn't work when build game using bob.jar [SOLVED]

When I make a bundle using editor2 - all works fine.
I check it using _G.unityads in DefCon.

But when I made build using bob.jar _G.unityads is nil. But apk size looks like it include my NE.

I am using last version of bob.jar (1.2.103).

My sh file:

#!/bin/bash
title=$(less game.project | grep "^title = " | cut -d "=" -f2 | sed -e 's/^[[:space:]]*//')
title_no_space=$(echo "${title}" | tr -d '[[:space:]]')

echo "Project: ${title}"

if [ ! -f bob.jar ]
	then
		echo "Unable to find bob.jar. Download it from d.defold.com."
		exit 1
fi

bob() {
	java -jar bob.jar $@
}

bundle() {
	platform=$1
	echo "${platform}"
	shift 1
	bob --platform ${platform} --bundle-output build/${platform} $@ bundle --debug
}

archive() {
	platform=$1
	if [ "${platform}" == "armv7-android" ]
		then
			echo "${title_no_space}.apk"
			mv "build/${platform}/${title}/${title}.apk" "${title_no_space}.apk"
	elif [ "${platform}" == "armv7-darwin" ]
		then
			echo "${title_no_space}.ipa"
			mv "build/${platform}/${title}.ipa" "${title_no_space}.ipa"
	else
		echo "${title_no_space}_${platform}.zip"
		rm -rf "${title_no_space}_${platform}.zip"
		cd build/${platform}
		zip -r -q "../../${title_no_space}_${platform}.zip" *
		cd ../..
	fi
}

deploy(){
	if [ "${platform}" == "armv7-darwin" ]
		then
		echo "${title_no_space}.ipa"
		ipa-deploy "build/${platform}/${title}.ipa"
	elif [ "${platform}" == "armv7-android" ]
		then
		echo "${title_no_space}.apk"
		adb install -r "build/${platform}/${title}/${title}.apk"
	fi
}

#bob --email john.smith@acme.com --auth foobar resolve

# build
echo -e "\n[Building]"
rm -rf build
bob --archive build

# bundle platforms
echo -e "\n[Bundling]"
bundle armv7-android #--private-key key.pk8 --certificate certificate.pem
# bundle armv7-darwin --identity YOUR_IDENTITY --mobileprovisioning comagulevtest.mobileprovision
# bundle x86-win32
# bundle x86-darwin
# bundle x86-linux
# bundle js-web

# archive bundled platforms
echo -e "\n[Archiving]"
# archive armv7-android
# archive x86-win32
# archive x86-darwin
# archive x86-linux
# archive js-web
# archive armv7-darwin

echo -e "\n[Installing]"
deploy armv7-android
# archive x86-win32
# archive x86-darwin
# archive x86-linux
# archive js-web
# deploy armv7-darwin
1 Like

I haven’t heard of any issues, but to be honest I haven’t tried myself either. I took a look at the code and bob should be supporting native extensions. There’s a couple of new options to bob that aren’t in the documentation (@sicher, I’ve reported an issue regarding this):

  • build-server - ā€œThe build server (when using native extensions)ā€ (Defaults to https://build.defold.com)
  • defoldsdk - ā€œWhat version of the defold sdk (sha1) to useā€ (defaults to same version as bob)
  • binary-output - ā€œLocation where built engine binary will be placedā€ (Defaults to ā€˜<build-output>/<platform>/’)

What if you enter a bogus value for build-server (like https://foobar.com). Does the build fail?

Is your extension part of the project or pulled in as a library dependency?

1 Like

Extension is part of project (it’s a project where I making an extension)

I tried to add build parameter:

bob --archive build --build-server ā€œhttps://foobar.comā€

and bundle

bob --platform ${platform} --bundle-output build/${platform} $@ bundle --debug --build-server ā€œhttps://foobar.comā€

I have no error when app builds.

Project with errors in Native Extension source code is building with bob.jar.

Ok, it seems to be ignoring native extensions completely. I’ll give this a try on Monday (at company kickoff now). Or maybe @sicher can assist tomorrow?

2 Likes

Hmm, I just tried this and it worked for me (Using the example extension-android):

> java -jar ~/bob.jar --platform armv7-android --archive build
> java -jar ~/bob.jar --platform armv7-android bundle

Could it be that bob isn’t the latest version?

I’m sure that is the last version.

But it works with your parameters.

Looks like an issue with this line in bundle.sh by @britzl :

And more specifically with $@ bundle --debug

I tried to replace :

with

bob --platform ${platform} --bundle-output build/${platform} --archive build
bob --platform ${platform} --bundle-output build/${platform} bundle --debug

and all works fine.

My version of bundle.sh with deploy for android and ios is here

1 Like