Is there a way to change the gradle.properties file in Unity

后端 未结 5 626
故里飘歌
故里飘歌 2021-01-05 07:45

Unity has a default gradle.properties file that gets added during the build process. While its possible to change the build.gradle and the settings.gradle files as mentioned

5条回答
  •  失恋的感觉
    2021-01-05 08:26

    Maybe my answer is a bit outdated but in Unity 2020 you can do it in:

    Player Settings -> Tab Android (with robot obviously) -> Publishing Settings -> Custom Gradle Properties Template (checkbox).

    After enabling the checkbox you will see the path to gradleTemplate.properties (usually it appears in Assets/Plugins/Android directory) file which will be merged with final gradle.properties.

    Everything you need you can write to the end of file after **ADDITIONAL_PROPERTIES** string.

    Example:

    org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
    org.gradle.parallel=true
    android.enableR8=**MINIFY_WITH_R_EIGHT**
    **ADDITIONAL_PROPERTIES**
    
    android.useAndroidX = true // I added this property to fix error:  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.
    

    Also on screenshot:

提交回复
热议问题