【发布时间】:2018-03-27 09:38:54
【问题描述】:
我正在尝试按照此处找到的 Google Payment API 教程进行操作: https://developers.google.com/payments/setup
我在同步 gradle 时遇到以下错误
主要是 - 我得到了错误:
无法解决:com.google.android.gms:play-services-wallet:11.4.0
错误下方有一个指向"Install Repository and sync project" 的链接,但是当我单击该链接时,没有任何反应。
有没有办法手动安装必要的存储库?还有什么我想念的吗?我什至需要安装什么存储库?我已尝试更新所有内容。
分级:
{
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.google.android.gms.samples.wallet"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.google.android.gms:play-services-wallet:11.4.0'
compile 'com.google.android.gms:play-services-tasks:11.4.0'
compile 'com.google.android.gms:play-services-base:11.4.0'
compile 'com.google.android.gms:play-services-basement:11.4.0'
}
顶级 Gradle
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
清单
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Enables the Google Payment API -->
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
我一直试图让它运行大约一周,并且每当我包含谷歌钱包时都无法让 gradle 同步。我已经尽可能地遵循本教程。我已经从 github 上的示例应用程序、我自己的应用程序、从零开始的几个应用程序中尝试了它。我不知道如何让这个存储库工作。
谢谢。 约翰
【问题讨论】:
标签: android android-gradle-plugin google-play-services android-support-library android-pay