• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
7
Question by chetan312 · Jan 05, 2021 at 04:03 PM · build-error

build error

i have upgraded unity from unity 2019 to latest. Suddenly, i cant build my project. There is an error
" mainTemplate.gradle file is using the old aaptOptions noCompress property definition which does not include types defined by unityStreamingAssets constant." There is only one thread regarding this issue, but i have not found any solution. if someone has any knowledge about this issue. plz help.Thanks.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image makaka-org · Jan 07, 2021 at 01:54 AM 0
Share

2021.1.0b1?

avatar image chetan312 makaka-org · Jan 10, 2021 at 04:33 AM 0
Share

2020.2.1f unity

7 Replies

· Add your reply
  • Sort: 
avatar image
10

Answer by makaka-org · Jan 07, 2021 at 12:34 PM

For Unity 2021.1 and Android 10 I use mainTemplate.gradle for my project and here I changed to this:

 aaptOptions {
         noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
         ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
     }

from this:

 aaptOptions {
         ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
     }


Or you can just delete current .gradle file and Unity regenerates it again with correct settings.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Toastbyte · Jan 18, 2021 at 12:59 PM 0
Share

I have the same problem. Whenever I edit the .gradle file and try to build the project, it automatically regenerates the file to the way it was before, without the changes and displays the same error. I'm using Unity 2020.2.1f1. Any help would be greatly appreciated

avatar image makaka-org Toastbyte · Jan 18, 2021 at 04:41 PM 0
Share

Try 2021.1. I have success only here.

avatar image DropShmot · Mar 25, 2021 at 04:07 PM 2
Share

For Unity 2020.3.x (LTS) If you are using a SDK, check all its folders. There may be a mainTemplate.gradle file that overwrites the mainTemplate.gradle in the Assets/Plugins/Android. Check the line

 noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]

and replace to

 noCompress '.unity3d', '.ress', '.resource', '.obb' + unityStrea$$anonymous$$gAssets.tokenize(', ')

avatar image IMD · Feb 16 at 04:23 AM 1
Share

Nice, this top answer worked for me.

I performed the change on the mainTemplate.gradle file under path: ...../Assets/Plugins/Android/mainTemplate.gradle

Many thanks @makaka-org :)

avatar image
2

Answer by ahmedaniss · Jun 01, 2021 at 09:25 AM

Problem fixed here : https://youtu.be/auKRHn90D1I

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AminAghajoon · Mar 12 at 03:12 PM 0
Share

The trick to switch to mono and back to IL2cpp worked!!!!

avatar image
1

Answer by Russel1 · Jan 07, 2021 at 05:04 PM

Try to delete the mainTemplate.gradle and let Unity create it again by checking the checkmark for the mainTemplate in the Android Settings.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image chetan312 · Jan 09, 2021 at 02:33 PM 0
Share

okay , i am using Unity 2020.2.1f and i tried to edit mainTemplate.Gradle as @makaka-org suggested but when i try to make a build this file return to its previous version then i deleted the mainTemplate.gradle and but the new gradle file which unity generate is similar to previous one. .

avatar image Russel1 chetan312 · Jan 10, 2021 at 12:02 PM 0
Share

@chetan312 Try unchecking the box in the Android settings for the use of a custom main gradle file, then delete the mainTemplate.gradle file. And then re-checking the box for use of a custom main gradle file.

avatar image Toastbyte Russel1 · Jan 18, 2021 at 12:58 PM 0
Share

I have the same problem. I tried what you mentioned, but it keeps generating the same file and when trying to build the same error appears. ""

avatar image
1

Answer by peterfiveeight · Mar 25, 2021 at 01:40 PM

For anyone still having this issue when upgrading from 2019.x to 2020.3. I found mainTemplate.gradle in the following folder:

"\Unity\2020.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates". Settings were as described in the above answers which was confusing as I was still getting the build error.

I then checked my project folder for mainTemplate.gradle and found a copy hiding here:

{ProjectName}\Assets\Plugins\Android\

Once I removed the copy here the build then worked as expected.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by a-chambriat · Mar 25, 2021 at 04:00 PM

switched to 2020.3.0f1 here, its a pain to build for Android :

  • What went wrong: Execution failed for task ':launcher:processReleaseResources'.

    A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade AAPT2 aapt2-3.6.0-6040484-windows Daemon #0: Unexpected error during link, attempting to stop daemon.

    This should not happen under normal circumstances, please file an issue if it does.
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image a-chambriat · Mar 25, 2021 at 04:12 PM 0
Share

Configure project :launcher

WARNING: The option 'android.enableR8' is deprecated and should not be used anymore. It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8. Exception while marshalling C:\Program Files\Unity\Hub\Editor\2020.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\28.0.3\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2020.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2020.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-29\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2020.3.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

123 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android app not building after switching to il2cpp 0 Answers

UnityMetalSupport.h Xcode Error 0 Answers

Gradle Build Errors For Android,Gradle build errors.. 0 Answers

Problem with building Player 1 Answer

Android Build failed with an exception - Help 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges