Problems building project with native extension in 1.2.165 (SOLVED)

#1

Unfortunately I have the same error as @alexandr.gil. I don’t use third-party extensions just mine. The same project was bundled (android) with version 1.2.164. So far I can tell you so much, I’m trying to figure out what the problem might be.

0 Likes

Defold 1.2.165 has been released
Defold 1.2.165 has been released
#2

Can you check the log file from the build server please? It’s in <project folder>/build/<platform>/log.txt

0 Likes

#3

I have attached the log file.

I looked into the log file, it may have something to do with the new gradle build process. I have collected the native extension (ags_native) dependencies earlier with pompom script, which seems to be confused with the new release. Thank you for bringing this issue to your attention!

log.txt (3.0 KB)

0 Likes

#4
java -jar /opt/local/bin/manifestmergetool.jar --platform android --main /tmp/job7089426517555631456/upload/AndroidManifest.xml  --lib /tmp/job7089426517555631456/upload/ags_native/manifests/android/AndroidManifest.xml  --out /tmp/job7089426517555631456/build/AndroidManifest.xml

aapt package -f  -m --auto-add-overlay -M /tmp/job7089426517555631456/build/AndroidManifest.xml -I /var/extender/sdk/6fac6e80f09ab297093e3ff65a7f45ad56e06e33/defoldsdk//ext/share/java/android.jar -J /tmp/job7089426517555631456/build/rjava  -S /tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0  -S /tmp/job7089426517555631456/upload/packages/com.defold.android/res  -S /tmp/job7089426517555631456/upload/ags_native/res/android/res/androidx-core-core-1.0.0 

/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:11: error: Attribute "alpha" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:16: error: Attribute "fontProviderAuthority" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:19: error: Attribute "fontProviderPackage" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:22: error: Attribute "fontProviderQuery" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:28: error: Attribute "fontProviderCerts" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:36: error: Attribute "fontProviderFetchStrategy" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:51: error: Attribute "fontProviderFetchTimeout" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:61: error: Attribute "fontStyle" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:67: error: Attribute "font" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:73: error: Attribute "fontWeight" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:78: error: Attribute "fontVariationSettings" has already been defined
/tmp/job7089426517555631456/upload/packages/ags_native/androidx-core-core-1.0.0/values/androidx-core-values.xml:81: error: Attribute "ttcIndex" has already been defined

/tmp/job7089426517555631456/build/AndroidManifest.xml:142: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

Yes, this is definitely a resource and dependency conflict. I would recommend that you remove all transitive dependencies that you have in your project and create a build.gradle with the main dependency of your project and leave the rest to gradle.

1 Like

#5

HI @coderm4ster!
Is your extension by any chance available online so I could test it?
I’d like to improve upon the error message you got in the editor, so that it isn’t so cryptic :slight_smile:

0 Likes

#6

Hi @Mathias_Westerdahl!

The extension is not available online, I wrote this to game specifically for some reasons. If you need it, I’ll share with you the source of the entire game just to make the editor as good as possible.

1 Like

#7

Ok, no worries, I’ll create something to mimic that behavior.
Btw, do you use a custom AndroidManifest.xml, if so, what path does it have in the project?

0 Likes

#8

Yes, I use two.

1: <project_root>\manifests\android\AndroidManifest.xml
2: <project_root>\ags_native\manifests\android\AndroidManifest.xml

The first is set in the game.project file.

1 Like

#9

Hi @Mathias_Westerdahl!

Did you reproduce the mysterious message problem? If not, I can try to do a minimal sample project with my native extension that triggers the above message.

0 Likes

#10

Yes, the error detection will work better in the next release. We should be able to detect the error and give a better error message.

But to solve your actual problem I think it would be good if you first strip away transitive dependencies (jars and resources) from your project and start using a Gradle file.

1 Like

#11

Yes, I will definitely switch to gradle :slight_smile:
My question was rather to reproduce the error message as to whether it succeeded.

0 Likes

#12

Not sure I understand. The root cause is the error we see in log.txt (ie “error: Error: No resource found that matches the given name (at ‘value’ with value ‘@integer/google_play_services_version’).”). This is caused by issues with dependencies and if you move to gradle it should hopefully work.

The “resource cannot be null” error is shown because we are unable to properly parse the log.txt and connect and error with a resource in your project (so that you can click on the error in Build Errors and open the appropriate file). @JCash has improved the parsing to avoid this error in the future.

0 Likes

#13

I had some free time today, so I switched the dependency resolution management to build.gradle.

build.gradle contains the following:

dependencies {
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
}

Also, I deleted all Google Ads resources and libraries (jars) from the project. Only the library (jar) of my native extension remained.
The project is successfully compiled, the apk is created. Installing apk on a tablet crashes the game.

Looking at logcat, you can see:

2020-02-09 19:27:27.679 20780-20798/? E/AndroidRuntime: FATAL EXCEPTION: Thread-6
    Process: com.albertgamesstudio.cbb, PID: 20780
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/R$string;
        at com.google.android.gms.common.api.internal.GoogleServices.<init>(Unknown Source)
        at com.google.android.gms.common.api.internal.GoogleServices.initialize(Unknown Source)
        at com.google.android.gms.internal.measurement.zzx.zzf(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:44)
        at com.google.android.gms.internal.measurement.zzx.<init>(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:22)
        at com.google.android.gms.internal.measurement.zzx.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:6)
        at com.google.android.gms.measurement.api.AppMeasurementSdk.getInstance(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:2)
        at com.google.android.gms.internal.ads.zzaku.zzd(com.google.android.gms:play-services-ads-lite@@18.3.0:43)
        at com.google.android.gms.internal.ads.zzakt.run(com.google.android.gms:play-services-ads-lite@@18.3.0)
        at java.lang.Thread.run(Thread.java:762)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.R$string" on path: DexPathList[[zip file "/data/app/com.albertgamesstudio.cbb-2/base.apk"],nativeLibraryDirectories=[/data/app/com.albertgamesstudio.cbb-2/lib/arm64, /data/app/com.albertgamesstudio.cbb-2/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.google.android.gms.common.api.internal.GoogleServices.<init>(Unknown Source) 
        at com.google.android.gms.common.api.internal.GoogleServices.initialize(Unknown Source) 
        at com.google.android.gms.internal.measurement.zzx.zzf(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:44) 
        at com.google.android.gms.internal.measurement.zzx.<init>(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:22) 
        at com.google.android.gms.internal.measurement.zzx.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:6) 
        at com.google.android.gms.measurement.api.AppMeasurementSdk.getInstance(com.google.android.gms:play-services-measurement-sdk-api@@17.1.0:2) 
        at com.google.android.gms.internal.ads.zzaku.zzd(com.google.android.gms:play-services-ads-lite@@18.3.0:43) 
        at com.google.android.gms.internal.ads.zzakt.run(com.google.android.gms:play-services-ads-lite@@18.3.0) 
        at java.lang.Thread.run(Thread.java:762) 

Is it possible that the specified class is not integrated during build.gradle processing? Any tips for this?

0 Likes

#14

Is this what the official Google documentation also recommends?

0 Likes

#15

Yes, the description mentions:

0 Likes

#16

Ok, and you are using the default Android manifest? And your extension doesn’t contain any Android manifest stub itself? Or any custom resources?

0 Likes

#17

The project now uses the default AndroidManifest.xml. I put one thing into AndroidManifest.xml for my native extension.

Contents of \ags_native\manifests\android\AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="{{android.package}}">
    <uses-sdk android:minSdkVersion="{{android.minimum_sdk_version}}" android:targetSdkVersion="{{android.target_sdk_version}}"/>
    <application>
        <!-- For AdMob -->
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-8781683557290096~6246305074" />
    </application>
</manifest>

Here’s what the native extension directory looks like:

1 Like

#18

Ok, so I should be able to reproduce the exact same problem with a basically empty project and the build.gradle file. Or even better if you would be willing to share the project with me (bjorn@defold.com).

2 Likes

#19

Last night, I emailed you the project, thank you for your help!

0 Likes

#20

Hi! Yeah, got it but I can’t access. We have a redirect from defold.com to defold.se which prevents me from accessing the shared project. Could you please also invite bjorn@defold.se?

0 Likes