playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.46k stars 966 forks source link

Resource '@integer/google_play_services_version' not found in AndroidManifest.xml #2019

Closed zaferyy closed 6 years ago

zaferyy commented 6 years ago

Hi,

I have GooglePlayGamesPlugin-0.9.42 and it doesn't work with Gradle build it says:"Resource '@integer/google_play_services_version' not found in AndroidManifest.xml:35"

when I delete the below meta-data line from GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml

    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

it is working but can not login to google play games platform. if this line is not needed anymore why don't you delete it. if I don't use Gradle it is working but I need Gradle for adding firebase (with a lot of unnecessary plugins).

thanks.

jongorr commented 6 years ago

Same.

alleluso commented 6 years ago

Same here

sieonK commented 6 years ago

I have the same problem. I need a Gradle build, but I can not find a way to solve the problem.

justy-p commented 6 years ago

The line from above has to be MOVED into the main AndroidManifest.xml (into the Assets/Plugins/AndroidManifest.xml).

zaferyy commented 6 years ago

That doesn't solve the problem

vcanellas commented 6 years ago

Same problem here

arodus commented 6 years ago

Remove the line from GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml and add the following line to Assets/Plugins/AndroidManifest.xml.

<meta-data android:name="google_play_services_version" android:value="GPG_VERSION" />

You have to replace GPG_VERSION with the version you are using. You can find the version in res/values/values.xml when you unpack the play-services-basement-x.y.z.aar.

sshumihin commented 6 years ago

Hi arodus. Your suggestion doesn't work for me because I have a conflict with another plugin DevToDev.

Attribute meta-data#com.google.android.gms.version@value value=(11720000) from AndroidManifest.xml:22:62-86 is also present at [:devtodev:] AndroidManifest.xml:64:13-66 value=(@integer/google_play_services_version). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:22:5-89 to override.

I have added 'tools:replace="android:value"' to my manifest and new an error fired after launch a game.

InvalidOperationException: There was an error creating a GameServices object. Check for log errors from GamesNativeSDK at GooglePlayGames.Native.PInvoke.GameServicesBuilder.Build

OpenLevel commented 6 years ago

same here. need a Gradle build

arodus commented 6 years ago

@sshumihin what does the log say?

OpenLevel commented 6 years ago

C:\Users\PIMMSong\Source\Repos\RollPlayingGame\Temp\gradleOut\GooglePlayGamesManifest.plugin\build\intermediates\bundles\release\aapt\AndroidManifest.xml:35:28-65: AAPT: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')

The problem has gone. I don't know why.

then the build succeeded but another error occurred like below : GamesNativeSDK` : Can't register class ...

sshumihin commented 6 years ago

@arodus

GRADLE ERROR : colliding-attributes
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
UnityEditor.Android.GradleInvokationException:ParseAndShowException()
UnityEditor.Android.PostProcessor.PostProcessRunner:RunAllTasks(PostProcessorContext)
UnityEditor.Android.PostProcessAndroidPlayer:PostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions, RuntimeClassRegistry, BuildReport)
UnityEditor.Android.AndroidBuildPostprocessor:PostProcess(BuildPostProcessArgs)
UnityEditor.PostprocessBuildPlayer:Postprocess(BuildTargetGroup, BuildTarget, String, String, String, Int32, Int32, BuildOptions, RuntimeClassRegistry, BuildReport) (at C:\buildslave\unity\build\Editor\Mono\BuildPipeline\PostprocessBuildPlayer.cs:271)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:335)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:232)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:210)
BuildManager:BuildAndroid(AndroidBuildSystem, AppStore, Boolean, BuildOptions, AndroidTargetDevice, Boolean) (at Assets\Infoshell\Scripts\Editor\BuildManager.cs:127)
MainMenu:BuildAndroidGradleDebug() (at Assets\Infoshell\Scripts\Editor\MainMenu.cs:190)

(Filename: Assets/Infoshell/Scripts/Editor/BuildManager.cs Line: 127)

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk1.8.0_111\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"

stderr[
F:\Work\MyProject\Temp\gradleOut\src\main\AndroidManifest.xml:24:62-86 Error:
    Attribute meta-data#com.google.android.gms.version@value value=(11720000) from AndroidManifest.xml:24:62-86
    is also present at [:devtodev:] AndroidManifest.xml:64:13-66 value=(@integer/google_play_services_version).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:24:5-89 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#com.google.android.gms.version@value value=(11720000) from AndroidManifest.xml:24:62-86
    is also present at [:devtodev:] AndroidManifest.xml:64:13-66 value=(@integer/google_play_services_version).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:24:5-89 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
arodus commented 6 years ago

@sshumihin I was referring to the log from the GamesNativeSDK. Since it seems that you already fixed the bug with the colliding attributes. It seems that the analytics plugin you are using does not support google play resolver and already contains all the libraries in it's own unity package. I guess there is some version mismatch between the libraries imported from the plugin and the libs from the resolver.

sshumihin commented 6 years ago

@arodus I think you are right. Thank you.

sshumihin commented 6 years ago

@arodus I removed DevToDev plugin and there is another an error:


stderr[
D:\MyProject\Temp\gradleOut\src\main\AndroidManifest.xml:23:62-86 Error:
    Attribute meta-data#com.google.android.gms.version@value value=(11720000) from AndroidManifest.xml:23:62-86
    is also present at [:play-services-basement-11.6.2:] AndroidManifest.xml:20:66-119 value=(@integer/google_play_services_version).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:5-89 to override.

Now the problem is Play-Services-Basement.

arodus commented 6 years ago

@sshumihin did you also remove the libraries which were imported by the plugin? Do you have a project to reproduce the error, or can you send a screenshot of the contents of the Assets/Plugins/Android folder.

sshumihin commented 6 years ago

@arodus I reproduced the issue on a clean project with GPGS only. There is a video how to reproduce. There is an Unity project

sshumihin commented 6 years ago

Sorry, I didn't share the video. Update.

arodus commented 6 years ago

I can build the project without any problem. It could be possible that the reason is the target api level on which you are the building the application. Since the default settings is Automatic (highest installed) this could also explain why the build works for me.

I currently have the following versions installed: image

sshumihin commented 6 years ago

Ok. Seems I figure it out.

I copy the 2 lines from the GPGS manifest to my manifest as is. Then I can build a project. I don't have to replace "integer/google_play_services_version" by the gp-basement version.

I will check it tomorrow again.

Note, when you do Android setup again the GPGS manifest recreate. You have to remove 2 lines again.

OpenLevel commented 6 years ago

I've solved the GamesNativeSDK problem

by add these 2 line to proguard-user.txt :

-keep class com.google.android.gms.** { *; }
-keep interface com.google.android.gms.** { *; }
sshumihin commented 6 years ago

I can't use the plugin.

  1. I can't build it because of the conflict with DevToDev. Ok, I fix it but then
  2. I can't build it because of "no found resource". Ok, I fix it but then
  3. I can't init the plugin because of ClassNotFoundException. Ok, I fix it but then
  4. I have a crash on init because Social.localUser is null. Ok, I fix it but then
  5. I can't sign in because of an ERROR_ON_AUTHORISED.

I give up. It's the worst plugin I have ever used.

creutzfeldt0 commented 6 years ago
  1. I can't sign in because of an ERROR_ON_AUTHORISED. same Issue "TokenFragment class not found error #2054"
    solved it.
pranavt7 commented 6 years ago

If I remove the following lines, the apk gets created, but I am not able to authenticate and email and username returns blank -

    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
Shaitan1805 commented 6 years ago

Can someone help me please? Had the same problem that I can't build. Removed the line like in the question in file GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml

Now I can build, but I am not able to login. In my Directory Assets/Plugins is no AndroidManifest.

Currently I get very frustrated with this package

shanta3220 commented 6 years ago

Hello everyone, I faced the same issue as you guys and spent almost 2 days searching for solutions and even used the solution arodus suggested, although it did build the apk but didn't let me sign in. So I kind of used every solutions I found on the internet and merged them together don't know exactly what actually made it work but it is working now, you can do the same thing and see if it works. I'm using unity 2017.2.0f3 and API 27.

  1. Instead of using the current build I used "GooglePlayGamesPlugin-0.9.41", you can find it here: https://github.com/EdgarGomez/UnityGooglePlayGameServices (you better download the whole zip because we will need for later steps).
  2. instead of using the current google play services of android I downloaded https://dl-ssl.google.com/android/repository/google_play_services_8298000_r28.zip this is developed by "Andrew S"(thank you!) and put this in Android-Sdk\extras\google after deleting the latest version of "google play services" from there.
  3. Another solution was to add the dependencies in the mainTemplate.gradle: find the gradle here: Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\GradleTemplates. just simply add in the mainTemplate.grade: dependencies { compile 'com.google.android.gms:play-services-games:11.0.2' } if you're not sure where to put it then just put it below the fileTree dependency.
  4. Now back to unity I opened "GooglePlayGamesPlugin-0.9.41.unitypackage", after it was done. from EdgarGomez's project(link in step 1) , i copied/override all the .aar files from 'UnityGooglePlayGameServices/Assets/Plugins/Android/" into my project's UnityGooglePlayGameServices/Assets/Plugins/Android/". if you open the unitypackage you may find "only 1 .aar file" in that folder or if all of them are available just delete them and put his ones, doesn't matter though just all .aar file and paste his ones there.
  5. lastly don't forget to add: <activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> in your AndroidManifest.xml(GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/) because without this your leaderboards, achievements probably wouldn't work properly.
claywilkinson commented 6 years ago

The manifest attribute has been removed in 0.9.50, so gradle builds will work now without modification.

BenoitFreslon commented 6 years ago

Sorry but when I try to build with gradle I can't sign in too.

Without gradle: http://prntscr.com/i78v42 With gradle: http://prntscr.com/i78vcr

aneeshpanoli commented 6 years ago

6 months and no progress on this? I can do gradle build but get operationexception error, cant sign in. Everything works fine with the Internal build.

j-ito-Tribe commented 5 years ago

The line from above has to be MOVED into the main AndroidManifest.xml (into the Assets/Plugins/AndroidManifest.xml).

I seen the same problem, I have solved it with your solution!

srcsameer commented 5 years ago

Hi! guys i am having the same issue, i am using unity 2018.3.1f1 and i have imported my old project(it has gpgs 0.9.42) from unity 2017 to 2018 i was unable to build APKs but after moving The line <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> from Assets\GooglePlayGames\Plugins\Android\GooglePlayGamesManifest.plugin\AndroidManifest.xml to Assets\Plugins\Android\AndroidManifest.xml

i can build the APK but when i am testing it, it's crashing after opening.

j-ito-Tribe commented 5 years ago

Hello srcsameer, did you already resolve the crash issue? If not, can you post those error logs?

srcsameer commented 5 years ago

@j-ito-Tribe thanks for your reply, but i have solved it.

LifeIsJourney commented 5 years ago

Hi! guys i am having the same issue, i am using unity 2018.3.1f1 and i have imported my old project(it has gpgs 0.9.42) from unity 2017 to 2018 i was unable to build APKs but after moving The line <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> from Assets\GooglePlayGames\Plugins\Android\GooglePlayGamesManifest.plugin\AndroidManifest.xml to Assets\Plugins\Android\AndroidManifest.xml

i can build the APK but when i am testing it, it's crashing after opening.

If you are using unity for this. You don't have to change anything in android:name = "". Change andoid:value to your admob id. I think this video will solve this issue https://youtu.be/qlRvqi1DAQk

victor871129 commented 5 years ago

GameAnalytics can trigger that error in AndroidManifest.xml https://gameanalytics.com/docs/item/unity-sdk#android

idurvesh commented 5 years ago

I disabled Unity's default Android configuration, ran the Playstore resolve, then again enabled default config

alamboley commented 5 years ago

@victor871129 how did you resolve this?

victor871129 commented 5 years ago

Go to preferences, uncheck the NDK, SDK and JDK checkboxes, click 3 Browse buttons. Then check those NDK, SDK and JDK checkboxes again. Restart Unity app. I also removed temporarily that conflicting line on AndroidManifest.xml in gameanalytics.aar zip-like file.

alamboley commented 5 years ago

@victor871129 that did the trick, many thanks!

med-the-lord commented 2 years ago

Remove the line from GooglePlayGames/Plugins/Android/GooglePlayGamesManifest.plugin/AndroidManifest.xml and add the following line to Assets/Plugins/AndroidManifest.xml.

<meta-data android:name="google_play_services_version" android:value="GPG_VERSION" />

You have to replace GPG_VERSION with the version you are using. You can find the version in res/values/values.xml when you unpack the play-services-basement-x.y.z.aar.

Your suggestion solved my issue, 1M thanks :)