104 words
1 minute

Fixing the AndroidX Build Error After Adding Firebase to Unity

2022-11-14
Views —

After importing Firebase into Unity, I encountered the following build error:

Could not determine the dependencies of task ':launcher:lintVitalRelease'.
> 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.fragment:fragment:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0,

The project depended on AndroidX, but android.useAndroidX had not been enabled.

Enable the Gradle properties template#

Under Build Settings → Player → Publishing Settings, enable Custom Gradle Properties Template. Unity generates the template at Assets/Plugins/Android/gradleTemplate.properties.

Add these two lines:

android.useAndroidX=true
android.enableJetifier=true

My resulting properties file looked like this:

org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.enableR8=**MINIFY_WITH_R_EIGHT**
unityStreamingAssets=**STREAMING_ASSETS**
android.useAndroidX=true
android.enableJetifier=true
**ADDITIONAL_PROPERTIES**

That resolved the problem in this project.

Fixing the AndroidX Build Error After Adding Firebase to Unity
https://blog.coding1024.com/en/posts/3a0ce390/
Author
huangjx
Published at
2022-11-14
License
CC BY-NC-SA 4.0

Comments

Questions, ideas and experiences are welcome. Please be kind and avoid sharing private information.

Loading comments…