The Painful Unity project exports every assembly to Android (I'm doing something wrong)

I would like to know if there is a faster way than the following steps for testing a Unity application with Android (gradle export):

  • Change something in unity.
  • Build Settings and Launch -> Export (New Gradle)
  • Now the old gradle in the Android project is replaced , so I need to copy the paste from the backup
  • the folder is also replaced so i need to copy the backup paste
  • Finally, create and run the APK on the device.

Steps 3 and 4 obviously make this process painful (slow) , I found the Unity android plugin manifest.xml so that it stays the same (edited directly in Unity). So am I doing something wrong? Is there a way to update only parts of an Android project (for example, if I only changed one line of C # Script, just rebuild it for Android)

Tell me if I don't explain it clearly enough :)

EDIT: I already posted this in the Unity forum, but I didn’t receive a response another day later

+5
source share
2 answers

You can create your own Gradle file. Put it in the Plugins / Android folder and name it mainTemplate.gradle It will use this.

As far as I know, there is no way to recover only part of it. Unity does not create java files from C # code. He creates his own modules and uses them directly.

By the way, why do you even export? Why not compile directly to your device?

+2
source

I just wanted to get an additional answer to this question, although it is a bit outdated (just in case, someone else in the future asks a question about this, as I do). I personally need to use both Android Studio and Unity, so creating a plugin was not really an option for me.

Now I have a custom gradle file as described in the accepted answer. However, I also added an additional resources folder (Android explained it well here: https://developer.android.com/studio/write/add-resources.html ).

You just need to modify your own gradle file to add paths to both resource directories. Add resources that you do not want Unity to overwrite in another resource folder.

Now every time you rebuild the project, the resources remain, and you do not need to copy them.

+1
source

Source: https://habr.com/ru/post/1265538/


All Articles