[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where do I find the gradle file? #9

Closed
chuakc92 opened this issue Nov 21, 2016 · 17 comments
Closed

Where do I find the gradle file? #9

chuakc92 opened this issue Nov 21, 2016 · 17 comments

Comments

@chuakc92
Copy link

I'm following the steps outlined here:

1: Click Add Firebase to your Android app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
2: When prompted, enter your app's package name. It's important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.
3: Download a google-services.json file when instructed. You can redownload this file again at any time.
4: Copy this file to anywhere inside your project's assets folder.

After 4, the next step prompts me to add lines into gradle files, but I can't find anywhere to download the gradle package for Unity. Am I missing something here?

@stewartmiles
Copy link
Contributor

Where is the documentation you're referring to?

Are the docs part of the Firebase Console (i.e http://console.firebase.google.com) or something else?

@chuakc92
Copy link
Author

Here: https://firebase.google.com/docs/unity/setup

Under Add Firebase to Your app, it says to "Click Add Firebase to your Android app and follow the setup steps.".

The last step of that includes linking the gradle files. How exactly do I do that for Unity? Or how does it read the Json file downloaded?

@stewartmiles
Copy link
Contributor

Ah I see, yes we're aware we need to update the documentation in the
Firebase Console's add project steps to support other integrations e.g
Unity, C++ etc. For the moment, after you've downloaded the .json / .plist
just go back to https://firebase.google.com/docs/unity/setup and continue
working through the setup steps.

e.g for Android

"
5. Add the google-services.json file to the project.

Drag the google-services.json downloaded from the Firebase console into
any folder in your project.

"

Cheers,
Stewart

On Mon, Nov 21, 2016 at 9:56 AM, Kuan Chern Chua notifications@github.com
wrote:

Here: https://firebase.google.com/docs/unity/setup

Under Add Firebase to Your app, it says to "Click Add Firebase to your
Android app and follow the setup steps.".

The last step of that includes linking the gradle files. How exactly do I
do that for Unity? Or how does it read the Json file downloaded?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFw1RBtq1z7CM652Tnic91LSfF6fTQoEks5rAdtdgaJpZM4K39Y8
.

@chuakc92
Copy link
Author

I've tried that, but even when FetchAsync() returned true, the values did not fetch correctly from the server. It still returned the default values. What might be the problem here? I've checked my bundle identifier and it's correct.

Even the quickstart app I downloaded returned the default values.

@stewartmiles
Copy link
Contributor

Did you call ActivateFetched() ?

https://github.com/firebase/quickstart-unity/blob/master/remote_config/testapp/Assets/TestApp/UIHandler.cs#L130

Fetch simply downloads data from the server. ActivateFetched switches the
local config for the most recently fetched config values.

On Mon, Nov 21, 2016 at 4:42 PM, Kuan Chern Chua notifications@github.com
wrote:

I've tried that, but even when FetchAsync() returned true, the values did
not fetch correctly from the server. It still returned the default values.
What might be the problem here? I've checked my bundle identifier and it's
correct.

Even the quickstart app I downloaded returned the default values.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#9 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFw1RHnXns-JXW7Fj92_LfcTBL9vgI5nks5rAjpngaJpZM4K39Y8
.

@chuakc92
Copy link
Author
chuakc92 commented Nov 22, 2016

Yes, I did. Unfortunately, it still returns the default value. I'm doing this in the Unity editor, though. Do I have to build it on a device to work?

Also, how exactly do I link my. json file? Do I only need to drag and drop it any where in my folder?

I'm using the test-app in my Unity. Here are the logs:

RemoteConfig configured and ready!
CurrentData:
config_test_string : default local string
config_test_int : 1
config_test_float : 1
config_test_bool : False
Fetching data...
Fetch completed successfully!
Remote data loaded and ready.
CurrentData:
config_test_string : default local string
config_test_int : 1
config_test_float : 1
config_test_bool : False

Edit:
Tried building both testapps for remote config and analytics and they BOTH crash on startup. No errors were thrown in editor. I'm using Unity 5.3.5.

@stewartmiles
Copy link
Contributor

The desktop implementations consist of stubs (i.e it's purely for testing and doesn't connect to our backends).
https://firebase.google.com/docs/unity/setup#stub_implementations_for_the_editor

You need to build and deploy on Android and iOS for our SDKs to work.
https://firebase.google.com/docs/unity/setup#overview

Regarding the crash, what logs do you see from the devices?

@stewartmiles
Copy link
Contributor

Also, regarding the .json and .plist files you need to drag / drop them anywhere in your Unity project folder. If you do not do this, check the Unity console - you'll see errors in the Unity console warning you that when the projects launch on device they'll fail to work.

@chuakc92
Copy link
Author
chuakc92 commented Nov 23, 2016

I know how to look at logs within logcat, but what do I look for in this case? It crashes on every single device.

Can you look at this: http://pastebin.com/96nRSgXk

@stewartmiles
Copy link
Contributor

The crash you're seeing is due to missing Android resources in your project. You can verify Android resources are unpacked by looking for files matching under Assets/Plugins/Android/firebase-* . If they're not present, select the "Assets -> Play Services Resolver -> Android Resolver -> Resolve Client Jars" from the Unity menu.

Check your Unity logs to see whether any errors are reported, if errors are present you'll need to resolve them before proceeding to build the application.

@chuakc92
Copy link
Author

There are NO errors in Unity.

"Assets -> Play Services Resolver -> Android Resolver -> Resolve Client Jars" from the Unity menu asks if I want to replace Google Play services 9.8.0 with 10.0.0, then throws this error:

Unable to find jar in the system path. This tool is required to process Play Services dependencies. Either set JAVA_HOME or add jar to the PATH variable to resolve this error.

@stewartmiles
Copy link
Contributor
stewartmiles commented Nov 24, 2016 via email

@chuakc92
Copy link
Author
chuakc92 commented Nov 24, 2016

I was able to build the app. The first fetch was successful. After I added the parameters to Firebase console and fetched data again, it says:
Fetch completed successfully!
Fetch failed for unknown reason

I checked and the bundle identifiers and the .json are correct. How do I resolve this issue?

Here are my parameters which already have been published: http://imgur.com/a/gJLyy

FIXED: I had to change the bundle identifier.

@stewartmiles
Copy link
Contributor
stewartmiles commented Nov 29, 2016 via email

@chuakc92
Copy link
Author
chuakc92 commented Nov 29, 2016

Hi Stewart, I managed to fix the above errors.

I have another question. I'm trying to include Admob in my project. The Firebase documentation pointed me to this package: https://github.com/googleads/googleads-mobile-unity/releases/tag/3.1.2

I downloaded the package and imported it then built.

It built successfully onto my device, but my app crashes upon starting and throws the following error:

11-29 15:07:46.231 1678-3326/? I/ActivityManager: Start proc 25811:com.testapp/u0a140 for activity com.testapp/com.unity3d.player.UnityPlayerActivity 11-29 15:07:46.256 1678-2748/? I/qti_sensors_hal: LIS3DH Accelerometer: batch 15.00 inf 11-29 15:07:46.295 25811-25811/? D/AndroidRuntime: Shutting down VM 11-29 15:07:46.296 25811-25811/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.testapp, PID: 25811 Theme: themes:{} java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/com.testapp-1/base.apk) at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) at android.app.ActivityThread.installProvider(ActivityThread.java:5207) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4802) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4742) at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method) at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334) at android.app.ActivityThread.handleBindApplication(<Xposed>) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1424) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5471) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102) 11-29 15:07:46.297 1678-3339/? W/ActivityManager: Force finishing activity com.testapp/com.unity3d.player.UnityPlayerActivity

What is causing this?

I tried the following:

  • Resolve Client Jar, which replaces some play-services files with their 10.0.0 variant (not doing so throws a Failed to repackage resources error in Unity when building)
  • Importing Google Play Games, which doesn't fix anything

@stewartmiles
Copy link
Contributor

Looks like you're ending up with conflicting aars (Android packages) being included in the project.

Before you attempted to resolve the error - which I think made this worse - do you have the error logs reported by the plugins? It's likely the Jar Resolver complained about conflicting aar versions, it would be great to see exactly what happened so that we can fix it.

@stewartmiles
Copy link
Contributor

Closing out the issue here as it looks like you've cross posted to the AdMob tracker.
googleads/googleads-mobile-unity#314

In future, please either close out duplicate threads / issues or reference the cross posts using a link as it saves everyone following along a lot of time searching for information or answering questions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants