Google Android Studio 中的 Maps v2。未找到 GeoPoint
Google Maps v2 in the Android Studio. Not found GeoPoint
我正在处理在 Eclipse 中编写的代码,我正在迁移到 Android Studio,但是我在导入时遇到了问题
com.google.android.maps.GeoPoint;
但我可以导入
com.google.android.gms.maps.GoogleMap;
我试图在我的 Gradle 文件中添加
compile 'com.google.android.gms:play-services:6.5.87'
而且我也尝试过使用 .jar,但是我没有得到好的结果。
compile files('libs/google-play-services.jar')
我在很多地方搜索过这个,但我没有找到任何可以帮助我的东西,万一有人解决了这个问题并希望帮助我,我谢谢你。
请按照 Android Studio
中 Add Google Play Services to Your Project
的所有步骤操作:
1.Open 应用程序模块目录中的 build.gradle
文件。
注意:Android Studio 项目包含一个顶级 build.gradle 文件和每个模块的 build.gradle 文件。请务必为您的应用程序模块编辑该文件。有关 Gradle.
的更多信息,请参阅使用 Gradle 构建您的项目
2.Add 最新版本播放服务依赖项下的新构建规则。例如:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
确保每次更新此版本号 Google Play 服务更新。
注意:如果您的应用中的方法引用数量超过65K limit
,您的应用可能会编译失败。在编译您的应用程序时,您可以通过仅指定您的应用程序使用的特定 Google Play 服务 API 而不是所有这些 API 来缓解此问题。有关如何执行此操作的信息,请参阅有选择地将 API 编译到您的可执行文件中。
3.Save 更改并单击工具栏中的 Gradle Files
同步项目。
4.Open 您应用的清单文件并添加以下标记作为元素的子元素:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
您现在可以开始使用 Google Play services APIs
开发功能。
详情请参考here
为了工作,我用它来替换我的 Gradle 文件中的以下行。
android {
...
compileSdkVersion 16
...
}
到
android {
...
compileSdkVersion "Google Inc.:Google APIs:16"
...
}
我正在处理在 Eclipse 中编写的代码,我正在迁移到 Android Studio,但是我在导入时遇到了问题
com.google.android.maps.GeoPoint;
但我可以导入
com.google.android.gms.maps.GoogleMap;
我试图在我的 Gradle 文件中添加
compile 'com.google.android.gms:play-services:6.5.87'
而且我也尝试过使用 .jar,但是我没有得到好的结果。
compile files('libs/google-play-services.jar')
我在很多地方搜索过这个,但我没有找到任何可以帮助我的东西,万一有人解决了这个问题并希望帮助我,我谢谢你。
请按照 Android Studio
中 Add Google Play Services to Your Project
的所有步骤操作:
1.Open 应用程序模块目录中的 build.gradle
文件。
注意:Android Studio 项目包含一个顶级 build.gradle 文件和每个模块的 build.gradle 文件。请务必为您的应用程序模块编辑该文件。有关 Gradle.
2.Add 最新版本播放服务依赖项下的新构建规则。例如:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
确保每次更新此版本号 Google Play 服务更新。
注意:如果您的应用中的方法引用数量超过65K limit
,您的应用可能会编译失败。在编译您的应用程序时,您可以通过仅指定您的应用程序使用的特定 Google Play 服务 API 而不是所有这些 API 来缓解此问题。有关如何执行此操作的信息,请参阅有选择地将 API 编译到您的可执行文件中。
3.Save 更改并单击工具栏中的 Gradle Files
同步项目。
4.Open 您应用的清单文件并添加以下标记作为元素的子元素:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
您现在可以开始使用 Google Play services APIs
开发功能。
详情请参考here
为了工作,我用它来替换我的 Gradle 文件中的以下行。
android {
...
compileSdkVersion 16
...
}
到
android {
...
compileSdkVersion "Google Inc.:Google APIs:16"
...
}