向 Android 项目添加 Google 驱动器支持
Adding Google Drive support to Android project
我想在我的应用程序中包括 Google 驱动器支持,使用 Android Studio 3.0.1
我的应用程序 build.gradle 文件中有以下条目:
dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services-drive:11.6.0'
当我尝试进行 Gradle 构建时,出现以下错误:
单击 "Install Repository and sync project" 时出现以下错误:
我的依赖部分的语法有误吗?
Google 显示使用 implementation
指令而不是 compile
但对我也不起作用。
我试过将 play-services-drive 行更改为:
compile 'com.google.android.gms:play-services-drive:+'
但后来我遇到了一大堆以前从未见过的资源错误。在我开始尝试添加下面的 Google 导入之前,这个项目已构建并 运行:
错误:
是否遵循了第 4 步?
If you receive an error, check that your top-level build.gradle contains a reference to the google() repo or to maven { url "https://maven.google.com" }.
你可以像这样把它放在你的顶级 build.gradle
文件中:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Google 的 Play 服务经常被可怕地记录下来。您应该查阅 their demo project 作为有关如何使用 API 的更好参考(这是示例代码的来源)。希望对您有所帮助!
我想在我的应用程序中包括 Google 驱动器支持,使用 Android Studio 3.0.1
我的应用程序 build.gradle 文件中有以下条目:
dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services-drive:11.6.0'
当我尝试进行 Gradle 构建时,出现以下错误:
单击 "Install Repository and sync project" 时出现以下错误:
我的依赖部分的语法有误吗?
Google 显示使用 implementation
指令而不是 compile
但对我也不起作用。
我试过将 play-services-drive 行更改为:
compile 'com.google.android.gms:play-services-drive:+'
但后来我遇到了一大堆以前从未见过的资源错误。在我开始尝试添加下面的 Google 导入之前,这个项目已构建并 运行:
错误:
是否遵循了第 4 步?
If you receive an error, check that your top-level build.gradle contains a reference to the google() repo or to maven { url "https://maven.google.com" }.
你可以像这样把它放在你的顶级 build.gradle
文件中:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Google 的 Play 服务经常被可怕地记录下来。您应该查阅 their demo project 作为有关如何使用 API 的更好参考(这是示例代码的来源)。希望对您有所帮助!