Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix UnityThemeSelector error due to missing files in unityLibrary/src/android/res #894

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

timbotimbo
Copy link
Collaborator

Description

If you export the example project for Android with Unity 2023.3.x, you will get errors related to a missing style/UnityThemeSelector.
This is because the file that declares this style is accidentally deleted during the export, this pull request makes sure the file is kept.

Cause

During the unity export, the folder unityLibrary/src/main/res is accidentally deleted during a copy.

It first copies unity/<project>/Builds/<name>.apk/unityLibrary to android/unityLibrary.
unityLibrary/src/main/res now contains multiple files (may differ per Unity version)

  • freeformwindow.xml
  • ids.xml
  • styles.xml

Then it copies unity/<project>/Builds/<name>.apk/launcher/src/main/reson top of that.
This copy function deletes the destination folder.
So now unityLibrary/src/main/res only contains:

  • string.xml

The missing styles.xml file is now causing this issue.

Error message

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     C:\Users\User\Documents\unity_widget\example\build\app\intermediates\packaged_manifests\release\AndroidManifest.xml:81: error: resource style/UnityThemeSelector (aka com.xraph.plugin.flutter_unity_widget_example:style/UnityThemeSelector) not found.
     error: failed processing manifest.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:bundleReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
   > Android resource linking failed
     C:\Users\User\Documents\unity_widget\example\build\app\intermediates\bundle_manifest\release\AndroidManifest.xml:81: error: resource style/UnityThemeSelector (aka com.xraph.plugin.flutter_unity_widget_example:style/UnityThemeSelector) not found.
     error: failed processing manifest.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant