将谷歌分析添加到 Android 应用程序
我有一个正在运行的 Android 应用程序,现在想向其中添加谷歌分析。我按照此处的说明进行操作:
http://code.google.com/mobile/analytics /docs/android/
当我添加导入语句时:
import com.google.android.apps.analytics.GoogleAnalyticsTracker;
我收到错误:
The import com.google.android cannot be resolved
我在项目中创建了一个 libs 目录并将 libGoogleAnalytics.jar 文件放入其中。我尝试将其添加到 AndroidManifest.xml:
<uses-library android:name="com.google.android.analytics" />
我尝试打开和关闭 Eclipse 并执行“Project / Clean”。似乎没有什么能影响这个问题。我对 Java 有点陌生。我缺少什么?
I have a working android app and now want to add google analytics to it. I am following the instructions here:
http://code.google.com/mobile/analytics/docs/android/
When I add the import statement:
import com.google.android.apps.analytics.GoogleAnalyticsTracker;
I get the error:
The import com.google.android cannot be resolved
I have created a libs directory in the project and placed the libGoogleAnalytics.jar file in it. I tried adding this to the AndroidManifest.xml:
<uses-library android:name="com.google.android.analytics" />
I have tried opening and closing Eclipse and doing 'Project / Clean'. Nothing seems to affect the problem. I am somewhat new to Java. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您应该将库 libGoogleAnalytics.jar 添加到构建路径(在库中右键单击 libGoogleAnalytics.jar -> BuildPAth -> 添加到构建路径)
不要在 Manifest 文件中添加任何内容,并在 java 文件中使用 cmd+Shift+O(对于 Mac,对于 Windows Ctrl+Shift+O)自动组织导入)
I think you should add library libGoogleAnalytics.jar to build path (in libs right click on libGoogleAnalytics.jar -> BuildPAth -> Add to Build Path)
Do not add anything in Manifest file and in your java file use cmd+Shift+O(for Mac, for Windows Ctrl+Shift+O) to automatically organize your imports)