- Home /
Android Plugin with AppCompat Theme
Hi everyone,
I encountered a problem which I am unable to solve til now. So any input is greatly appreciated.
I'm trying to build a plugin that uses an AppCompat style and I keep getting the error "Failed to re-package resources"
The error seems to come from an error within my .aar file when Unity compiles it. It has the error:
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
Anyone has any solution to this? Thanks in advance!
For your info, I am using the latest Unity and I also imported Cardboard SDK to the Unity project.
How do you add an AppCompat theme to Unity Activity? I tried this but in Java it still says my Activity needs an AppCompat theme.
Also do you know how to start an AppCompatActivity in Unity, I can't get it working...
Answer by amillardo · Aug 28, 2015 at 08:21 AM
Hi guys,
I managed to get it working (like finally)!!
Well anyway, the above problem arise because Unity does not include appcompat library when it builds. I read about this in the unity blog. That is because of several reasons but mainly because of the APK size.
So if your plugin needs appcompat library, you need to add the library manually.
ps. If you only add appcompat library, it might cause another error saying "Rejecting re-init on previously-failed class java.lang.Class" If this happens, try adding the support-v4 library too and hopefully it will be okay. (At least this works for me!)
try copying from android sdk folder check this address "Android-SD$$anonymous$$\extras\android\m2repository\com\android\support" or you can search in sdk folder root.
found it sdk\extras\android\m2repository\com\android\support thanks
And where to paste it? directly in Assets folder?
Answer by unity_qj65t-V2DB8gZw · Mar 15, 2018 at 11:12 PM
I'm having the same problem and the solution seems to be no longer valid plus it is unclear as the comments point it out. I re-posted the (kind of) same problem on Stack Overflow: https://stackoverflow.com/questions/49309958/. You can comment on either places with more clarification about what to copy where with the latest tools.