Search Unity

GameCircle and Unity 5.2 - AndroidManifest.xml issues

Discussion in 'Editor & General Support' started by Carwashh, Sep 18, 2015.

  1. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    I'm trying to implement Amazons GameCircle, but whenever I do a build using their AndroidManifest.xml I get the following errors.

    Code (csharp):
    1.  
    2. AndroidManifest.xml:20: error: Error: No resource found that matches the given name (at 'theme' with value '@style/GCOverlay').
    3.  
    4. 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?
     
  2. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    'lil help?
     
  3. Tinytouchtales

    Tinytouchtales

    Joined:
    Dec 30, 2013
    Posts:
    23
    Hi,

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

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    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.
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @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.
     

    Attached Files:

  6. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    @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
    Code (csharp):
    1.  
    2. Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    3. /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
    4.  
    5. stderr[
    6. ERROR: No argument supplied for '--extra-packages' option
    7. Android Asset Packaging Tool
    8.  
     
  7. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I am not sure SDK 23 is supported in unity... (but i may be wrong on that one

    Which res folder did u remove?
     
  8. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    I think I've only got the 1 res folder /Plugins/Android/res which has in it drawable; layout; raw; and values
     
  9. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    My script should've moved that one under
    Assets/Plugins/Android/ResourcesLibrary/res
     
  10. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    It may have been in there then, putting it back in there gives me a build error of this.

     
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I see. These styles are coming from the GameCircle library. Did you import that jar into your Unity project ?
     
  12. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    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
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    are they all in there and marked in the plugin inspector for Android ?
     
  14. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    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.
     

    Attached Files:

  15. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
  16. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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
     
  17. Tinytouchtales

    Tinytouchtales

    Joined:
    Dec 30, 2013
    Posts:
    23
    Thanks for your help Iiortal. I think as Carwashh said we need to push the amazon guys to fix this on their side.
     
  18. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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...
     
  19. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    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.
     
  20. RSNick

    RSNick

    Joined:
    Jul 31, 2014
    Posts:
    2
    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"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="your.package.name"
    android:versionCode="1"
    android:versionName="1.0" >
    </manifest>

    project.properties
    android.library=true

    I am not an expert but this worked for me.
    I hope this may help someone.
     
    chico_barnstorm and Carwashh like this.
  21. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    hi!
    i m having same isseu. after installing unity 5.2f3
    i made new project and try to compile it but continually getting this error.

    CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    C:\Users\aammf\AppData\Local\Android\android-sdk\build-tools\23.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/aammf/AppData/Local/Android/android-sdk\platforms\android-21\android.jar" -F bin/resources.ap_

    stderr[
    ERROR: Unable to open class file gen\con\hi\hi\R.java: No such file or directory
    ]
    stdout[
    Configurations:
    (default)
    xhdpi-v4

    Files:
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    values\strings.xml
    Src: () res\values\strings.xml
    AndroidManifest.xml
    Src: () AndroidManifest.xml

    Resource Dirs:
    Type drawable
    drawable\app_banner.png
    Src: (xhdpi-v4) res\drawable-xhdpi\app_banner.png
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    Type values
    values\strings.xml
    Src: () res\values\strings.xml
    Including resources from package: C:\Users\aammf\AppData\Local\Android\android-sdk\platforms\android-21\android.jar
    applyFileOverlay for drawable
    applyFileOverlay for layout
    applyFileOverlay for anim
    applyFileOverlay for animator
    applyFileOverlay for interpolator
    applyFileOverlay for transition
    applyFileOverlay for xml
    applyFileOverlay for raw
    applyFileOverlay for color
    applyFileOverlay for menu
    applyFileOverlay for mipmap
    Processing image: res\drawable-xhdpi\app_banner.png
    Processing image: res\drawable\app_icon.png
    (processed image res\drawable\app_icon.png: 94% size of source)
    (processed image res\drawable-xhdpi\app_banner.png: 93% size of source)
    (new resource id app_banner from xhdpi-v4\drawable\app_banner.png #generated)
    (new resource id app_icon from drawable\app_icon.png #generated)
    ]
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.HostView:OnGUI()
     
  22. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    RazaTech likes this.
  23. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @aammfee you may be suffering from a similar issue related to the res/ folder.

    Do you have anything under Assets/Plugins/Android/res ? if so, try to use my editor script to migrate that into the new form...
     
    RazaTech likes this.
  24. liuk

    liuk

    Joined:
    Jul 3, 2015
    Posts:
    2
    I am trying to Build&Run my app in to Google glass. But I got next error. Any suggestions how to fix it ?

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

    stderr[
    AndroidManifest.xml:21: error: Error: No resource found that matches the given name (at 'resource' with value '@XML/my_voice_trigger').

    ]
     
  25. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Your manifest references some resource (my_voice_trigger) but this resource is not provided during the build process.

    Do you have an .xml file called my_voice_trigger? where is it located in the project ? Also, what Unity version are you on ?
     
  26. liuk

    liuk

    Joined:
    Jul 3, 2015
    Posts:
    2
    I fixed that error by coping google-play-services-lib folder.
    Now i can build&run my app, and it's doesn't show me any error. But, I cannot observe my app in glass menu.
    This is my code, thanks for advice:
    strings.xml
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <string name="app_name">Time_A_Scene</string>
    <string name="glass_voice_trigger">PLAY_A_GAME</string>
    </resources>

    my_voice_trigger.xml
    <?xml version="1.0" encoding="utf-8"?>
    <trigger keyword="@String/glass_voice_trigger">
    </trigger>

    AndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    android:installLocation="preferExternal"
    android:theme="@android:style/Theme.NoTitleBar"
    android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

    <uses-feature android:name="android.hardware.camera" />
    <supports-screens
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"
    android:xlargeScreens="true"
    android:anyDensity="true"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
    android:icon="@drawable/app_icon"
    android:label="@String/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:debuggable="false">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    android:label="@String/app_name">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    <intent-filter>
    <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
    </intent-filter>
    <meta-data
    android:name="com.google.android.glass.VoiceTrigger"
    android:resource="@XML/my_voice_trigger" />
    </activity>
    <activity android:name="com.unity3d.player.VideoPlayer"
    android:label="@String/app_name"
    android:screenOrientation="portrait"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>
    <!--
    To support devices using the TI S3D library for stereo mode we must
    add the following library.
    Devices that require this are: ODG X6
    -->
    <uses-library android:name="com.ti.s3d" android:required="false" />
    <!--
    To support the ODG R7 in stereo mode we must add the following library.
    -->
    <uses-library android:name="com.osterhoutgroup.api.ext" android:required="false" />
    </application>
    </manifest>

    <!-- android:installLocation="preferExternal" -->
     
    liortal likes this.