Google Analytics显示无法解析android中的方法?

时间:2015-02-28 05:57:59

标签: android google-analytics android-library

在我的应用程序中,我正在使用Google Analytics。但GoogleAnalytics显示无法解析方法。

构建:gradle这个:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.squareup.picasso:picasso:2.5.0'
    compile project(':mobihelp_sdk_android_v1.3.1')
    compile files('libs/libGoogleAnalyticsV2.jar')
    compile 'ch.acra:acra:4.5.0'

}

清单文件:

<application
            android:name="com.reloadapp.reload.fragments.Application"
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
            <meta-data
                android:name="com.google.android.gms.analytics.globalConfigResource"
                android:resource="@xml/analytics_global_config" />
    </application>

请帮帮我。我需要添加哪个lib?

导入:

import java.lang.Thread.UncaughtExceptionHandler;
import java.util.HashMap;
import java.util.logging.Logger;
import android.util.Log;

import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import android.app.Application;
import android.util.Log;

import com.google.android.gms.analytics.ExceptionParser;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
import com.google.android.gms.analytics.HitBuilders;

1 个答案:

答案 0 :(得分:1)

不建议再使用Google Analytics jar,您应该使用最新的Google Play Services 6.5

apply plugin: 'com.android.application'
...

dependencies {
    ...
    compile 'com.google.android.gms:play-services-base:6.5.87'
}

有关Android版Google Analytics SDK v4的更多参考设置:https://developers.google.com/analytics/devguides/collection/android/v4/