GameCircle and Unity 5.2 - AndroidManifest.xml issues

I’m trying to implement Amazons GameCircle, but whenever I do a build using their AndroidManifest.xml I get the following errors.

AndroidManifest.xml:20: error: Error: No resource found that matches the given name (at 'theme' with value '@style/GCOverlay').

AndroidManifest.xml:22: error: Error: No resource found that matches the given name (at 'theme' with value '@style/GCAlert').

The Amazon_gc_styles.xml file is in /Plugins/Android/res/values and I’ve renamed it to styles.xml, but doing some research it looks like Unity may no longer support the use of this folder structure?

How do I fix this?

'lil help?

Hi,

i run into the same error. This error seems definitely be 5.2 related since with 5.1.3p2 there’s no issue.

Glad I’m not alone!

I came across this thread in my search, but don’t understand what’s being said tbh … was hoping someone would be able to noobify it to make it understandable for someone who hasn’t done Android development outside of Unity before.

@Carwashh i guess the behaviour was changed in 5.2 - you can no longer include resources freely under Assets/Plugins/Android/res. All resources should be included in the context of an “Android Library”.

In a nutshell, an Android library is a library project that can be included (referenced) by other android projects (e.g: your main app/game). Unity recognizes a folder as an android library by a few files in the root of that folder.

I attached a simple editor script that should “convert” your old structure into the new one that should be acceptable by Unity 5.2.

DISCLAIMER: I have only briefly tested this, please make a backup / use source control and any other safety measures before using this script.

HOW TO USE: Import the package into your project, right click in the project-window and click “Convert res to Android library”.

After running the tool, you should get a new folder in Plugins/Android/ResourcesLibrary that should contain your res/ folder and everything under it.

Try to compile your game after running the script and let me know if that solved your issues. BTW this should only be run once.

2303217–155111–UpdateResAndroid.unitypackage (2.22 KB)

@liortal Thanks for taking the time to help, I really appreciate it!

After running the script I was still getting the error I posted above, so I removed the /res folder and now I’m getting a different error

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Users/Carwash/Library/Android/sdk/build-tools/23.0.1/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "/Users/Carwash/Library/Android/sdk/platforms/android-23/android.jar" -F bin/resources.ap_ --extra-packages 

stderr[
ERROR: No argument supplied for '--extra-packages' option
Android Asset Packaging Tool

I am not sure SDK 23 is supported in unity… (but i may be wrong on that one

Which res folder did u remove?

I think I’ve only got the 1 res folder /Plugins/Android/res which has in it drawable; layout; raw; and values

My script should’ve moved that one under
Assets/Plugins/Android/ResourcesLibrary/res

It may have been in there then, putting it back in there gives me a build error of this.

I see. These styles are coming from the GameCircle library. Did you import that jar into your Unity project ?

The GameCircle SDK comes as a .unitypackage, it put gcunity.jar, gamecirclesdk.jar, AmazonInsights-android-sdk.jar, login-with-amazon-sdk.jar in /Plugins/Android

are they all in there and marked in the plugin inspector for Android ?

Yep (see screeny).

I’ve just installed/ updated loads of Android SDK stuff via the Android SDK Manager, no change though. Is it possible I’ve got something from there missing? - Though I can build without GameCircle.

A reply, from another user, on my Amazon forum post (https://forums.developer.amazon.com/forums/thread.jspa?threadID=8879&tstart=0) says to put “the GameCircle stuff” into an Android library. Is what you’ve been helping me with so far is just about the /res folder?

Yes. I am not sure why that is needed though (since Unity should take all the JARs and use them as references.
You can try to take all the GameCircle JARs and place them under the Plugins/Android/ResourcesLibrary/libs folder

Thanks for your help Iiortal. I think as Carwashh said we need to push the amazon guys to fix this on their side.

did you try what i suggested in the last post ? I believe this should work… I have no idea how responsive Amazon’s support is…

Moving all the JARs into Plugins/Android/ResourcesLibrary/libs still gives me the same error.

When I first posted on the Amazon dev forums I thought they were going to be helpful, saw them replying to other threads, but 5 days on and they haven’t done anything with my post.

I’m sending a message to them now via their ‘Contact Us’, in the hopes they read and respond to those messages.

OK guys a simple solution for this problem is to create an Android Library and move Amazon’s game circle res folder into it.

  1. First create a folder under Plugins/Android, lets call it AmazonGameCircleCustomLib.
  2. Then put the res folder into it (move Plugins/Android/res to Plugins/Android/AmazonGameCircleCustomLib/res).
  3. Then create an AndroidManifest.xml file on AmazonGameCircleCustomLib folder (keep only the basic things inside it).
  4. Then create a project.properties file on AmazonGameCircleCustomLib then edit it and add “android.library=true”.

The Plugins/Android/AmazonGameCircleCustomLib/ should contain:

  • res
  • AndroidManifest.xml
  • project.properties

More details:

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>


project.properties
android.library=true

I am not an expert but this worked for me.
I hope this may help someone.

2 Likes