Migrating from 172 to 181

#1

It’s a long story.
Up to version 172 we were updating editor regularly.
But then later versions had problems with stability of the LiveUpdate (I wrote about it in the relevant thread).
Thus our use of the 172 version was delayed until now.

And now we are trying to migrate again.
The results:

  1. the project runs and works stably when launched from the editor on the PC.
  2. it does not build for android. and that’s the current problem.

What are the project settings:

What are the errors:

Failed building Android resources to apk: E:\Work\Battler\Sources\_v39_(181)\build\armv7-android\packages\androidx.core-core-1.1.0.aar\res\values\values.xml:163: error: Attribute "fontVariationSettings" has already been defined

But that’s just the start of the topic. :slight_smile:
In fact, we can get a lot more strange mistakes.
For example these are:

Any advices would be welcome.

1 Like

#2

contextResource cannot be null

The last time I had this error it was due to an extension being updated to new Android setup and me needing to use https://build-stage.defold.com/ along with the latest alpha.

Make a blank project and put all of the deps you have into it and try making an Android build of that. You might need to increase the version numbers of one of them.

0 Likes

#3

Ok, let’s start by looking at your extensions:

  • RichText - No native code - not a problem :white_check_mark:
  • defold-cjson - Native code - nothing platform specific - not a problem :white_check_mark:
  • Monarch - No native code - not a problem :white_check_mark:
  • Ludobits - No native code - not a problem :white_check_mark:
  • IAP 3.0.1 - Native code - latest version - nothing AndroidX/Support library specific - maybe a problem :question:
  • Push 3.0.2 - Native code - latest version - AndroidX - potential problem :question:
  • Facebook 6.2.0 - Native code - latest version - AndroidX - potential problem :question:

I’m now starting Defold 1.2.180 and creating a new empty project:

43

Adding the three extensions with Android specific code:

33

Bundling:

54

18

And I get an error:

Caused by: com.android.builder.errors.EvalIssueException: This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.appcompat:appcompat:1.1.0, androidx.core:core:1.1.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.versionedparcelable:versionedparcelable:1.1.0, androidx.fragment:fragment:1.1.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.activity:activity:1.0.0, androidx.collection:collection:1.1.0, androidx.viewpager:viewpager:1.0.0, androidx.cardview:cardview:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.arch.core:core-common:2.1.0, androidx.savedstate:savedstate:1.0.0, androidx.annotation:annotation:1.1.0, androidx.lifecycle:lifecycle-common:2.1.0, androidx.appcompat:appcompat-resources:1.1.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-viewmodel:2.1.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.browser:browser:1.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-v4:1.0.0, androidx.media:media:1.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.vectordrawable:vectordrawable-animated:1.1.0, androidx.lifecycle:lifecycle-runtime:2.1.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.vectordrawable:vectordrawable:1.1.0, androidx.print:print:1.0.0
	at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:105)
	at com.android.builder.errors.IssueReporter.reportError$default(IssueReporter.kt:101)
	at com.android.build.gradle.internal.dependency.AndroidXDependencyCheck.execute(AndroidXDependencyCheck.kt:60)
	at ...

Ok, so I have a project which uses AndroidX. Got it. I need to use an app manifest where I specify that I want to use AndroidX:

03

27

Let’s try again. Voila!

What does this tell us? We know this works:

  • Defold 1.2.180
  • Build server build.defold.com
  • Empty project with three native extensions
    • Push
    • IAP
    • Facebook
  • Using an app manifest to enable AndroidX (we will add this as a checkbox in game.project at some point)
  • Using default AndroidManfest.xml from builtins
  • Using no bundle resources
  • Using default settings in the Android section of game.project

So we need to ask ourselves what is different in your project? Please confirm these:

  • Are you using the default AndroidManifest or do you have a custom manifest?
  • Are you bundling any Android specific resources?
  • Have you specified any Android icons or made other changes to the Android section of game.project?
  • Are you using any native extensions in your project that are not added as dependencies?
  • Are you using 1.2.180 with build.defold.com?
11 Likes