Android Studio 无法解析符号 GoogleAnalytics v4 [英] Android Studio cannot resolve symbol GoogleAnalytics v4

本文介绍了Android Studio 无法解析符号 GoogleAnalytics v4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Google Analytics(分析)集成到我的 Android 应用中,但遇到了问题.(见编辑)

遵循 已添加 稍后,在 4.3 版

Froyo 的 Google Play 服务停留在版本 3.2.65 并且不包括它,例如.

作为第一步,请构建您的应用并检查 \\build\intermediates\exploded-aar\com.google.android.gms\play-services 下的版本号.使用(当前)最新版本时,应该是 6.1.71 或左右.

如果显示的版本低于 4.3,那么它内部不会嵌入 Google Analytics,您应该检查/更新您的 SDK(特别是 Google Repository 在附加项下)

AdMob 已在 Google Play 服务 4.2 中添加.所以我敢打赌,你有这个.:)

I'm trying to integrate Google Analytics in my Android App, but I'm having trouble. (SEE EDIT)

Following https://developers.google.com/analytics/devguides/collection/android/v4/ when I create

HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();

Android Studio tell me that cannot resolve symbol Tracker.

I already use Google Play Services in my app to serve admob, so I don't understand why I cannot import com.google.android.gms.analytics.Tracker

In AndroidManifest.xml i have

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

What am I missing?

EDIT
i'm following also: How to integrate Google Analytics in Android app and http://java.dzone.com/articles/working-google-analytics-api

but I could not solve the problem

it is as if something was missing, google-play service is integrated because I'm using it for in-app purchase, but I do not understand why Android studio does not want to recognize google analytics.

add a photo for clarity:

project structure:

EDIT 2

android:value in this meta-data

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

where @integer/google_play_services_version is 4132500

I checked the sdk and I have no updates to be done in Extras

解决方案

I would guess that you have an old version of Google Play Services in your app.

My suspicion comes from the fact that the classes you can see, such as GoogleApiClient, GoogleAuthUtil, GooglePlayServicesNotAvailableException, &c have been present in Play Services from the very first versions (that I have used, at least) while GoogleAnalytics was added somewhat later, at version 4.3

Google Play Services for Froyo is stuck at version 3.2.65 and doesn't include it, for example.

As the first step, please build your app and check the version number under <project>\<module>\build\intermediates\exploded-aar\com.google.android.gms\play-services. When using the (current) latest version, it should be 6.1.71, or thereabouts.

If the version displayed there is lower than 4.3, then it won't have Google Analytics embeded inside, and you should check/update your SDK (particularly the Google Repository under extras)

AdMob was added in Google Play Services 4.2. So I would bet with some confidence that you have this one. :)

这篇关于Android Studio 无法解析符号 GoogleAnalytics v4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆