如何使用摇篮打造我导入com.google.android.gms。*在Android的工作室?摇篮、如何使用、工作室、Android

2023-09-06 16:10:47 作者:从学不会孤独

我按照步骤如下所述:设置  我点击了这个小同步项目摇篮按钮。摇篮和Android工作室的似乎的找到一切,但后来我不能实际使用GMS code。如果我尝试导入,我会自动完成com.google.android.gms,但没有进一步。我已经更新所有的软件包与Android SDK管理器。

I have followed the procedure as described here : Setup I have clicked on the little 'Sync project with Gradle' button. Gradle and Android Studio seem to find everything but then I can't actually use the gms code. If I try to import, I will get autocomplete for com.google.android.gms but no further. I have updated all the packages with Android SDK Manager.

在我运行Android 0.4.2工作室。 在我的minSdk设置为9 在我build.gradle包括编译com.google.android.gms:玩-服务:4.0.30

至于过程来讲,我应该准备code,但它只是不工作。任何想法?

As far as the procedure is concerned I should be ready to code, but it just doesn't work. Any ideas?

我可以找到ComGoogleAndroiddGmsPlayServices3265.aar文件在我展开包目录。在这个文件中我也找到了共同的目录中并在该我找到GooglePlayServicesUtil.class(这是不是被发现在我的应用程序)

I can find the ComGoogleAndroiddGmsPlayServices3265.aar file in my exploded bundles directory. Inside of that file I also find the common directory and inside that I find the GooglePlayServicesUtil.class (which is what's not being found in my app)

我迷路了。

现在的问题是不特定于谷歌播放服务或Android工作室。我尝试添加另一个库(HoloColorPicker),并有相同的结果。不过,我可以到图书馆的资源添加到我的项目!我能够加入他们在我的XML的布局,并查看他们在我的应用程序。我能够与他们进行互动,他们工作得很好。该问题再次出现了,当我试图引用他们在code。酷似与克的情况下,我只好code完成试图导入到实际的类的点时,并在code,我不能声明类。

The problem is not specific to Google Play Services OR Android Studio. I tried adding another library (HoloColorPicker) and had the same results. However, I was able to add the library's resources to my project! I was able to add them in my XML layouts and view them in my application. I was able to interact with them, they worked fine. The problem arose again when I tried to reference them in the code. Exactly like the case with gms, I had code completion when trying to import up to the point of the actual class, and I could not declare the class in the code.

我能够通过克隆并导入项目使用的库。

I was able to use the library by cloning it and importing the project.

此外,这是不是一个Android Studio的问题,因为同样的事情发生在命令行中使用./gradlew干净的构建

Also, this is not an Android Studio problem because the same thing happens on the command line with "./gradlew clean build"

推荐答案

这是Android的Studio中的当前错误:https://$c$c.google.com/p/android/issues/detail?id=64508本周是固定的。

This is a current bug in Android Studio: https://code.google.com/p/android/issues/detail?id=64508 to be fixed this week.

解决方法是关闭该项目,删除.iml文件和.idea项目,并重新导入该项目。

The workaround is to close the project, delete the .iml files and .idea project and re-import the project.