0

我試圖遵循了谷歌支付API教程在這裏找到: https://developers.google.com/payments/setup錯誤無法解析:com.google.android.gms:發揮服務錢包:11.4.0

我收到以下錯誤,當我在同步的gradle

image with errors

主要是 - 我得到的錯誤:

Failed to resolve: 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' 
} 

頂級搖籃

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的示例應用程序,從我自己的應用程序,從幾個應用程序從頭開始嘗試它。我不知道如何讓這個倉庫工作。

謝謝。 約翰

回答

0

我今天早上也遇到同樣的問題......但修正是使用「11.4.0」而不是使用「11.4.4」。也許在他們的網站上有錯誤,因爲當你把「11.4.0」安卓工作室給你的錯誤,它會告訴你更新到最新版本是「11.0.4」。

綜上所述,使用這一個,它應該工作

compile 'com.google.android.gms:play-services-wallet:11.0.4' 
2

你應該谷歌的行家添加到allprojectsbuildscript。所以,改變它是這樣的:

buildscript { 
    repositories { 
     jcenter() 
    } 
    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() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
相關問題