Search Unity

An "old new" problem: Google Play Services and Gradle build (com.google.android.gms.version meta).

Discussion in 'Android' started by AntonBreusov_TatemGames, Jan 29, 2017.

  1. AntonBreusov_TatemGames

    AntonBreusov_TatemGames

    Joined:
    Apr 20, 2016
    Posts:
    9
    Hi.

    Well, the history is so far: we hit 64K DEX methods limits again. We did it already two times and managed to bypass it by giving up on some Android plugins or optimizing etc but don't intend to do it anymore because it's clearly a dead end, so we're trying to move to "Multi Dex" building scenario. But when I'm trying to build project using new Gradle build system, it fails with a very known problem:

    As we know, Google Play Services add the following meta-data to AndroidManifest.xml (in a Assets\Plugins\Android\MainLibProj\AndroidManifest.xml):

    Resource integer "google_play_services_version" previously was located in "<android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/" in a "res/values/version.xml" file. But recent modular Google Play Services libraries store this value within a "play-services-basement-x.y.z.aar" library (in a "res/values/values.xml file) .

    So, it looks like Gradle and/or AAPT is not processing correctly resources from AAR libraries, or AAR files are not given to it. And I don't know who to blame: Unity, Unit-Gradle bridge, Gradle, Android SDK build tools (AAPT) etc? This also gives me a same result if I'm trying to export Gradle project and open it in Android Studio.

    This happens both in our big and dirty production project and fresh new empty test project with only
    GooglePlayGamesPlugin-0.9.36.unitypackage imported from official Google Play Services from Unity repo.

    About my environment:
    1. Unity 5.5.1f1 Win64 on Windows 10.
    2. Latest just updated Android SDK with latest build tools, platform tools, Android SDK, Support library, Google Play Services etc. Path from logs says that Build-tools version 25.0.2 used (latest available).
    3. JDK 1.8.0_102 .
    4. Mono 2.0 scripting backend used.
    5. Android libraries in a Assets\Plugins\Android\ :
    play-services-auth-10.0.1.aar
    play-services-auth-base-10.0.1.aar
    play-services-base-10.0.1.aar
    play-services-basement-10.0.1.aar
    play-services-drive-10.0.1.aar
    play-services-games-10.0.1.aar
    play-services-nearby-10.0.1.aar
    play-services-tasks-10.0.1.aar
    support-annotations-24.0.0.jar
    support-v4-24.0.0.aar
    All of them were selected automatically by Google Play Services Resolver script as latest available from Android SDK (except for support-* - it selected 24.0.0 even if there's more recent 24.x.x or even 25.x.x releases).
     
    Last edited: Jan 30, 2017
    Nsingh13, Qbit86 and philhindlept like this.
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,231
    You should also make sure that these libraries (specifically, play-services-basement-10.0.1.aar) are checked in the plugin inspector to get built into your .apk, otherwise they're meaningless.
     
    hfawwaz likes this.
  3. AntonBreusov_TatemGames

    AntonBreusov_TatemGames

    Joined:
    Apr 20, 2016
    Posts:
    9
    Where it is? You mean in Unity or in Android Studio? If you select them and check Inspector tab, they all have checked "Android" platform on them.
     
  4. AntonBreusov_TatemGames

    AntonBreusov_TatemGames

    Joined:
    Apr 20, 2016
    Posts:
    9
    Ok, it seems that I managed to overcome this issue. If I remove
    from "Assets/Plugins/Android/MainLibProj/AndroidManifest.xml" and leave it only in a central "Assets/Plugins/Android/AndroidManifest.xml" - then Gradle build compiles successfully. MainLibProj is a folder that comes with "Goole Play Services" package.

    It looks that this happens because Google Play Services AAR libraries are referenced from main application "build.gradle" file only, while MainLibProj is a sub-project and it's missing such references. I still think that this must be fixed somehow between Unity and Google teams, maybe by placing a dependencies on required AAR files to subprojects too. This will require some per-plugin "gradle.build" templating mechanism on Unity side and fixes on Google Play Services Resolver script side, probably, to work smoothly. I see a change in a Unity 5.5.1p1 about "Android: Gradle export now supports custom template". Can someone from Unity team elaborate and show some examples about it?
     
  5. AntonBreusov_TatemGames

    AntonBreusov_TatemGames

    Joined:
    Apr 20, 2016
    Posts:
    9
    OK, I found that if I copy Gradle template from "<UnityDir>\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates\mainTemplate.gradle" to "Assets\Plugins\Android\mainTemplate.gradle", then it gets used in Gradle builds instead of default one. The last step (I hope) is to manage to override my custom application Java class from the current specified in Manifest (it's Fabric's app now)...
     
  6. ScottyB

    ScottyB

    Joined:
    Apr 4, 2011
    Posts:
    132
    @AntonBreusov_TatemGames: Did you ever raise a bug with Unity regarding this issue using the Unity Bug Reporter?

    I'm running into the same issue and am wondering if there is a fix incoming or not.

    EDIT: I have reported a bug for this issue. It is case 889377
     
    Last edited: Mar 10, 2017
    Qbit86 and philhindlept like this.
  7. AntonBreusov_TatemGames

    AntonBreusov_TatemGames

    Joined:
    Apr 20, 2016
    Posts:
    9
    Not yet. There's actually a number of various issues (or points where it can be improved) regarding new Android build process using Gradle. I had hopes that this will be discussed first with someone from Unity Android team before formal bugs are filed. Those are including:
    1. This bug with meta-data with GMS version not being processed for dependent libraries by Gradle. This can be either Unity or Gradle issue, I don't know exactly who is guilty yet, Gradle is too new and complex and this topic needs further research before blaming one side or another.
    2. Built-in Gradle itself and Gradle-Android plugin in Unity are outdated already and needs updating to the latest version continuously. Currently we're building our project by exporting Android Studio Project and then doing final build from Android Studio because it allows us to use latest Gradle for Android plugin version.
    3. When doing Multidex build, Gradle build can fail because some JAR libraries contains BuildConfig.class classes in their namespaces and Gradle creates its own BuildConfig.class (don't know why), then it fails on one stage where JAR/AAR are repackaged because of conflicting files. I think this is also more a Gradle-Android plugin bug than Unity. I found only one quick workaround: manually remove BuildConfig.class from those JARs where they're conflicting. The better solution probably is writing some custom Gradle tasks or pre-post task hooks in Gradle template to remove these duplicates but I failed to find exact one.
    4. Unity really needs improvements in per-project templating mechanism in Gradle builds. Template for buid.gradle (by placing it in Assets\Plugins\Android\mainTemplate.gradle) is really helpful but we also need a template for gradle.properties, for example (too increase memory limits so it performs all tasks in-process - that is more faster and gives less build issues). We overcome this limitation by writing our own post-build hook script.

    Thanks. But is it private or not processed yet and not visible because of this? I cannot find it by number.
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,231
    @AntonBreusov_TatemGames what is the actual bug you encountered?

    Regarding the points you mention:

    1. gms version in library project - i am not sure you can reference a resource (google_play_services_version) that is defined in another library. All android libraries are merged into the final "app", but one library does not reference another ilbrary, hence the error.

    2. Not sure what gradle version is shipped with Unity, but they should probably aim to keep it up to date.. Also - how is exporting an Android studio project working out for you? I find that even for the simplest projects, the process of getting it to build in Android studio is just impossible. Can you briefly describe how you're doing that?

    3. Haven't faced this issue as i didn't use multidex yet.

    4. You can already define a per-project gradle template (just create Plugins/Android/mainTemplate.gradle in your project). For libraries, you still cannot include a per-library template, and i'm also not sure about proguard template per project (need to check).

    In any case- i have also reported a few gradle related bugs back in the day, since i really want the support for it to become stable, as we're also facing the 64k method limit...
     
  9. ScottyB

    ScottyB

    Joined:
    Apr 4, 2011
    Posts:
    132
    Yeah, that is an admirable idea but given the fact that Unity never responded to this post I thought I would go ahead and create a bug and point them to this thread to try and get their attention.
    It is currently private. In the latest versions of the Unity Bug Reporter, Unity has removed the option to choose whether a bug report should be made private or public on submit so I don't know how to turn it into a public bug.
     
  10. cruelbob

    cruelbob

    Joined:
    May 26, 2014
    Posts:
    20
    Any news?
     
  11. philhindlept

    philhindlept

    Joined:
    Dec 8, 2016
    Posts:
    8
    Thanks @AntonBreusov_TatemGames you've explained the issues very well, we're facing the same problems.

    I had upgraded to Google Play Game Services v0.9.38a, and in Unity 5.6.1 I was getting the error AAPT: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').

    The solution you suggested (remove <meta-data android:name="com.google.android.gms.version" android:value="@Integer/google_play_services_version" />
    from "Assets/Plugins/Android/MainLibProj/AndroidManifest.xml" and put that line into "Assets/Plugins/Android/AndroidManifest.xml" - fixed the problem for me.

    Thank you for your insight into this problem, I've been trying to find the solution all day long!
     
    Nsingh13 and MihaPro_CarX like this.
  12. kevinatgame

    kevinatgame

    Joined:
    Aug 31, 2015
    Posts:
    6
    the issue still exist in untiy 2017.1
    I encountered this issue in unity 5.6 then I tried to upgrade my unity editor to 2017 but the issue sitll there.
    I tried to create a new empty project and import google play game services plugin, this test project could be build with "internal" but gradle build will throw this "google play services version" issue. so I guess it's unity's bug.
    and, thanks @AntonBreusov_TatemGames , your solution works for me!
     
  13. lexi89puzzle

    lexi89puzzle

    Joined:
    Feb 22, 2017
    Posts:
    10
    @AntonBreusov_TatemGames - you are a legend. Great work on figuring out how to get round this. You solution worked for me too after a full day's searching. I'd buy you a beer if you were here.
     
    Nsingh13 likes this.
  14. DoomerDGR8

    DoomerDGR8

    Joined:
    May 15, 2015
    Posts:
    12
    Hi!

    I'm a little late to reach here but I'm facing the exact same issue and am not able to resolve it like you did. I have the latest Java JDK and Android SDK with all required packages from the Extra section. I have latest GooglePlayGame + GoogleMobileAds + PlayServicesResolver Unity Packages.

    I'm not able to build my game because of this error:

    Information:
    Code (CSharp):
    1. GRADLE ERROR : resource-not-found
    2. UnityEditor.HostView:OnGUI()
    Errors:
    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -classpath "E:\Program Files\Unity\2017.1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"
    3.  
    4. stderr[
    5. D:\my_work\my_company\my_game\Temp\gradleOut\ChartboostSDK\build\intermediates\bundles\release\aapt\AndroidManifest.xml:26:28-65: AAPT: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
    6.  
    7.  
    8. FAILURE: Build failed with an exception.
    9.  
    10. * What went wrong:
    11. Execution failed for task ':ChartboostSDK:processReleaseResources'.
    12. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\android-sdk\build-tools\26.0.0\aapt.exe'' finished with non-zero exit value 1
    13.  
    14. * Try:
    15. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    16. ]
    17. stdout[
    18. Observed package id 'add-ons;addon-unknown-unknown-23' in inconsistent location 'E:\Android\android-sdk\add-ons\addon-google_apis-google-23' (Expected 'E:\Android\android-sdk\add-ons\addon-unknown-unknown-23')
    19. Observed package id 'system-images;android-23;default;armeabi-v7a' in inconsistent location 'E:\Android\android-sdk\system-images\android-23\armeabi-v7a' (Expected 'E:\Android\android-sdk\system-images\android-23\default\armeabi-v7a')
    20. Incremental java compilation is an incubating feature.
    21. :preBuild UP-TO-DATE
    22. :preReleaseBuild UP-TO-DATE
    23. :checkReleaseManifest
    24. :preDebugBuild UP-TO-DATE
    25. :ChartboostSDK:preBuild UP-TO-DATE
    26. :ChartboostSDK:preReleaseBuild UP-TO-DATE
    27. :ChartboostSDK:compileReleaseNdk UP-TO-DATE
    28. :ChartboostSDK:compileLint
    29. :ChartboostSDK:copyReleaseLint UP-TO-DATE
    30. :ChartboostSDK:mergeReleaseProguardFiles UP-TO-DATE
    31. :ChartboostSDK:packageReleaseRenderscript UP-TO-DATE
    32. :ChartboostSDK:checkReleaseManifest
    33. :ChartboostSDK:prepareReleaseDependencies
    34. :ChartboostSDK:compileReleaseRenderscript
    35. :ChartboostSDK:generateReleaseResValues UP-TO-DATE
    36. :ChartboostSDK:generateReleaseResources
    37. :ChartboostSDK:packageReleaseResources
    38. :ChartboostSDK:compileReleaseAidl
    39. :ChartboostSDK:generateReleaseBuildConfig
    40. :ChartboostSDK:mergeReleaseShaders
    41. :ChartboostSDK:compileReleaseShaders
    42. :ChartboostSDK:generateReleaseAssets
    43. :ChartboostSDK:mergeReleaseAssets
    44. :ChartboostSDK:processReleaseManifest
    45. :ChartboostSDK:processReleaseResources FAILED
    46.  
    47. BUILD FAILED
    48.  
    49. Total time: 9.561 secs
    50. ]
    51. exit code: 1
    52. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    53. UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    54. Rethrow as GradleInvokationException: Gradle build failed
    55. UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    56. UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    57. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    58. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    59. UnityEditor.HostView:OnGUI()
    Code (CSharp):
    1. UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    2.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    3.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    4. UnityEditor.HostView:OnGUI()
    The error is same but it seems that it is being reported elsewhere (ChartboostSDK)

    Update:
    Current view of the \Assets\Plugins\Android folder: http://imgur.com/a/82Xd3



     
    Last edited: Aug 14, 2017
  15. DoomerDGR8

    DoomerDGR8

    Joined:
    May 15, 2015
    Posts:
    12
    If I amend the manifest for Chartboost and comment out the version line like you mentioned, I get more issues:

    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. C:/Program Files/Java/jdk1.8.0_144\bin\java.exe -classpath "E:\Program Files\Unity\2017.1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"
    3.  
    4. stderr[
    5. D:\my_work\my_company\my_game\Temp\gradleOut\GoogleMobileAdsPlugin\build\intermediates\bundles\release\aapt\AndroidManifest.xml:25:28-65: AAPT: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
    6.    
    7. D:\my_work\my_company\my_game\Temp\gradleOut\GoogleMobileAdsPlugin\build\intermediates\bundles\release\aapt\AndroidManifest.xml:34:28-49: AAPT: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').
    8.    
    9.  
    10. FAILURE: Build failed with an exception.
    11.  
    12. * What went wrong:
    13. Execution failed for task ':GoogleMobileAdsPlugin:processReleaseResources'.
    14. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\android-sdk\build-tools\26.0.0\aapt.exe'' finished with non-zero exit value 1
    15.  
    16. * Try:
    17. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    18. ]
    19. stdout[
    20. Observed package id 'add-ons;addon-unknown-unknown-23' in inconsistent location 'E:\Android\android-sdk\add-ons\addon-google_apis-google-23' (Expected 'E:\Android\android-sdk\add-ons\addon-unknown-unknown-23')
    21. Observed package id 'system-images;android-23;default;armeabi-v7a' in inconsistent location 'E:\Android\android-sdk\system-images\android-23\armeabi-v7a' (Expected 'E:\Android\android-sdk\system-images\android-23\default\armeabi-v7a')
    22. Incremental java compilation is an incubating feature.
    23. :preBuild UP-TO-DATE
    24. :preReleaseBuild UP-TO-DATE
    25. :checkReleaseManifest
    26. :preDebugBuild UP-TO-DATE
    27. :ChartboostSDK:preBuild UP-TO-DATE
    28. :ChartboostSDK:preReleaseBuild UP-TO-DATE
    29. :ChartboostSDK:compileReleaseNdk UP-TO-DATE
    30. :ChartboostSDK:compileLint
    31. :ChartboostSDK:copyReleaseLint UP-TO-DATE
    32. :ChartboostSDK:mergeReleaseProguardFiles UP-TO-DATE
    33. :ChartboostSDK:packageReleaseRenderscript UP-TO-DATE
    34. :ChartboostSDK:checkReleaseManifest
    35. :ChartboostSDK:prepareReleaseDependencies
    36. :ChartboostSDK:compileReleaseRenderscript
    37. :ChartboostSDK:generateReleaseResValues UP-TO-DATE
    38. :ChartboostSDK:generateReleaseResources
    39. :ChartboostSDK:packageReleaseResources
    40. :ChartboostSDK:compileReleaseAidl
    41. :ChartboostSDK:generateReleaseBuildConfig
    42. :ChartboostSDK:mergeReleaseShaders
    43. :ChartboostSDK:compileReleaseShaders
    44. :ChartboostSDK:generateReleaseAssets
    45. :ChartboostSDK:mergeReleaseAssets
    46. :ChartboostSDK:processReleaseManifest
    47. :ChartboostSDK:processReleaseResources
    48. :ChartboostSDK:generateReleaseSources
    49. :ChartboostSDK:incrementalReleaseJavaCompilationSafeguard
    50. :ChartboostSDK:compileReleaseJavaWithJavac
    51. :ChartboostSDK:processReleaseJavaRes UP-TO-DATE
    52. :ChartboostSDK:transformResourcesWithMergeJavaResForRelease
    53. :ChartboostSDK:transformClassesAndResourcesWithSyncLibJarsForRelease
    54. :ChartboostSDK:mergeReleaseJniLibFolders
    55. :ChartboostSDK:transformNative_libsWithMergeJniLibsForRelease
    56. :ChartboostSDK:transformNative_libsWithSyncJniLibsForRelease
    57. :ChartboostSDK:bundleRelease
    58. :GoogleMobileAdsPlugin:preBuild UP-TO-DATE
    59. :GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE
    60. :GoogleMobileAdsPlugin:compileReleaseNdk UP-TO-DATE
    61. :GoogleMobileAdsPlugin:compileLint
    62. :GoogleMobileAdsPlugin:copyReleaseLint UP-TO-DATE
    63. :GoogleMobileAdsPlugin:mergeReleaseProguardFiles
    64. :GoogleMobileAdsPlugin:packageReleaseRenderscript UP-TO-DATE
    65. :GoogleMobileAdsPlugin:checkReleaseManifest
    66. :GoogleMobileAdsPlugin:prepareReleaseDependencies
    67. :GoogleMobileAdsPlugin:compileReleaseRenderscript
    68. :GoogleMobileAdsPlugin:generateReleaseResValues
    69. :GoogleMobileAdsPlugin:generateReleaseResources
    70. :GoogleMobileAdsPlugin:packageReleaseResources
    71. :GoogleMobileAdsPlugin:compileReleaseAidl
    72. :GoogleMobileAdsPlugin:generateReleaseBuildConfig
    73. :GoogleMobileAdsPlugin:mergeReleaseShaders
    74. :GoogleMobileAdsPlugin:compileReleaseShaders
    75. :GoogleMobileAdsPlugin:generateReleaseAssets
    76. :GoogleMobileAdsPlugin:mergeReleaseAssets
    77. :GoogleMobileAdsPlugin:processReleaseManifest
    78. :GoogleMobileAdsPlugin:processReleaseResources FAILED
    79.  
    80. BUILD FAILED
    81.  
    82. Total time: 12.06 secs
    83. ]
    84. exit code: 1
    85. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    86. UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    87. Rethrow as GradleInvokationException: Gradle build failed
    88. UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    89. UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.GradleWrapper+Progress progress) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    90. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    91. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <32afc8f7b1124602990c059ee3fb5691>:0)
    92. UnityEditor.HostView:OnGUI()
     
  16. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    176
    @ScottyB, I want to folow that case but can't find it in fogbugz...
    Can you confirm it's still up or send the link?
     
  17. ScottyB

    ScottyB

    Joined:
    Apr 4, 2011
    Posts:
    132
    The latest reply to my bug report from Unity was basically "please try upgrading to the latest version of Unity and let us know if it is still a problem".

    I managed to hack around the problem so haven't followed up again but I should do so.
     
  18. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    413
    Consider explicit mentioning via `@` in case if Unity forum supports such notifications. For example: @Yury-Habets

    You should probably blame the authors of “play-games-plugin-for-unity” with such a great codename `MainLibProj`. They definitely should try building their plugin with Gradle option in Unity: https://github.com/playgameservices/play-games-plugin-for-unity/issues/1710
     
    Voxel-Busters likes this.
  19. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    @Qbit86 your spell casted to spawn me worked :p

    I've read the thread, and I think the manifest referencing resources from another libraries is just broken (on the google play side). I'm sure it won't build if you try it in Android Studio, as a non-Unity build.

    We are adding references to AARs/libraries automatically during build.

    The gradle plugin was also updated in recent Unity versions - it's not the latest and greatest though - hard to keep up with the pace of new versions released.
     
  20. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    413
    Do you mean issue with native libraries or with Unity plugin for Play Services?

    I've checked, looks like this placeholder
    Code (csharp):
    1. dependencies {
    2.     compile fileTree(dir: 'libs', include: ['*.jar'])
    3. **DEPS**}
    expands correctly to
    Code (csharp):
    1. dependencies {
    2.     compile fileTree(dir: 'libs', include: ['*.jar'])
    3.     ...
    4.     compile(name: 'play-services-basement-9.6.1', ext:'aar')
    5.     ...
    6. }
     
  21. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    413
    @Yury-Habets In Unity 2017.2.0f2 in Publishing Settings I see new setting — Minify. It has several options: “Proguard” and “Gradle (Experimental)”. Which one is preferable, and in what cases? Can it solve 65K DEX limit?
     
  22. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    "Gradle" means setting minifyEnabled to true in build.gradle. "Proguard" means same + enabling proguard.
     
    Qbit86 likes this.
  23. yosima

    yosima

    Joined:
    Mar 24, 2015
    Posts:
    1
    Wow That work for me ty
     
  24. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,231
    what is the difference between proguard and minifyEnabled ?
     
  25. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    @liortal that's more a question to Google... we just specify these params in build.gradle.
     
  26. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    413
    How we can specify in command line that Unity has to export Gradle project rather than build apk via legacy build system?
     
  27. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    Export project flag + gradle build system. Sorry don't have experience with batched builds so can't suggest a working sample.
     
  28. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    413
    Well, where are these flags stored so I could copy this file to buildbot machine?
     
  29. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
  30. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    You have to write a build script and somehow invoke it from the cmd line... As I said, I'm not an expert here, but I'm pretty sure it's easy to do.
     
    Qbit86 likes this.
  31. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    156

    Thank you for this solution saved me hours!
     
  32. teexiii

    teexiii

    Joined:
    Oct 7, 2015
    Posts:
    14
    It seems like Unity has problem when merging the AndroidManifest.xml files if there are more than 1 in your project folder, double check if you have more than one, remove the others and merge those tags inside manually into your main one. Good luck!
     
  33. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,065
    @teexiii there shouldn't be any issues merging manifests - could you elaborate?
     
  34. victorhugolafuente

    victorhugolafuente

    Joined:
    Dec 22, 2017
    Posts:
    5