defold / extension-ironsource

Defold native extension which provides access to IronSource mediation on Android and iOS
MIT License
10 stars 2 forks source link

Ad Quality SDK #20

Closed dri-richard closed 1 month ago

dri-richard commented 8 months ago
britzl commented 2 months ago

Adding Ad Quality SDK later than 7.15.0 will result in a runtime crash when calling IronSourceAdQuality.getInstance():

W  java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[], int, int)' on a null object reference
W   at com.ironsource.adqualitysdk.sdk.i.e.<clinit>(Unknown Source:3000)
W   at com.ironsource.adqualitysdk.sdk.i.aw.a(:195)
W   at com.ironsource.adqualitysdk.sdk.i.aw.<init>(:13)
W   at com.ironsource.adqualitysdk.sdk.i.z.<init>(:73)
W   at com.ironsource.adqualitysdk.sdk.i.z.ﻛ(:67)
W   at com.ironsource.adqualitysdk.sdk.IronSourceAdQuality.getInstance(:23)

One change between 7.15.0 and 7.16.0+ is that the sdk contains shared objects:

image

The extender server is sending these back to the client:

https://github.com/defold/extender/blob/dev/server/src/main/java/com/defold/extender/Extender.java#L2346

And bob will include them in the .aab:

Screenshot 2024-05-19 at 10 49 47

My assumption now is that the .so files are compressed and the manifest doesn't specify to unpack them using android:extractNativeLibs. It is however recommended to not compress the shared objects and not extract them.

https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs

The bundletool accepts a config json file which can specify a glob pattern for files that should not be compressed:

https://github.com/google/bundletool/blob/master/src/test/java/com/android/tools/build/bundletool/commands/BuildBundleCommandTest.java#L130-L133

AGulev commented 2 months ago

@britzl for now we create it in code, but we can move it into a file similar to what we have for AndroidManifest.xml: https://github.com/defold/defold/blob/582fd1c9c139ccd0a324842b6247dfdc9131c152/com.dynamo.cr/com.dynamo.cr.bob/src/com/dynamo/bob/bundle/AndroidBundler.java#L690-L692

britzl commented 2 months ago

Ah, we already do this. Hmm, yeah, we need to think about if we want to have extractNativeLibs as a game.project option and inject it into the AndroidManifest.xml, and if set to false, we add a glob pattern for .so files in AndroidBundler.java

AGulev commented 2 months ago

Adding Ad Quality SDK later than 7.15.0 will result in a runtime crash when calling IronSourceAdQuality.getInstance():

W  java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[], int, int)' on a null object reference
W     at com.ironsource.adqualitysdk.sdk.i.e.<clinit>(Unknown Source:3000)
W     at com.ironsource.adqualitysdk.sdk.i.aw.a(:195)
W     at com.ironsource.adqualitysdk.sdk.i.aw.<init>(:13)
W     at com.ironsource.adqualitysdk.sdk.i.z.<init>(:73)
W     at com.ironsource.adqualitysdk.sdk.i.z.ﻛ(:67)
W     at com.ironsource.adqualitysdk.sdk.IronSourceAdQuality.getInstance(:23)

One change between 7.15.0 and 7.16.0+ is that the sdk contains shared objects:

image

The extender server is sending these back to the client:

https://github.com/defold/extender/blob/dev/server/src/main/java/com/defold/extender/Extender.java#L2346

And bob will include them in the .aab:

Screenshot 2024-05-19 at 10 49 47

My assumption now is that the .so files are compressed and the manifest doesn't specify to unpack them using android:extractNativeLibs. It is however recommended to not compress the shared objects and not extract them.

https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs

The bundletool accepts a config json file which can specify a glob pattern for files that should not be compressed:

https://github.com/google/bundletool/blob/master/src/test/java/com/android/tools/build/bundletool/commands/BuildBundleCommandTest.java#L130-L133

It should be easy to test, I think, by manual apk repacking. Just to make sure it helps