简体   繁体   English

无法解析 com.google.gms:google-services:4.3.3

[英]Could not resolve com.google.gms:google-services:4.3.3

i installed last versions of android and flutter, after cloning project from github repository getting this error我安装了最新版本的 android 和 flutter,在从 github 存储库克隆项目后收到此错误

Launching lib\\main.dart on BKK LX2 in debug mode...在调试模式下在 BKK LX2 上启动 lib\\main.dart...

lib\main.dart
AILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 32s
Exception: Gradle task assembleDebug failed with exit code 1

this error apper only while cloning any project from github and bitbucket, if create new project working fine.如果创建新项目工作正常,则仅在从 github 和 bitbucket 克隆任何项目时才会出现此错误。

build.gradel file build.gradel 文件

    buildscript {
        ext.kotlin_version = '1.3.50'
        repositories {
            google()
            jcenter()
            maven { url 'https://maven.fabric.io/public' }
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.3'
            classpath 'io.fabric.tools:gradle:1.26.1'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://maven.fabric.io/public' }
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

app\\build.gradle file app\\build.gradle 文件

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1.4'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.4'
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.eightworx.excrm"
        minSdkVersion 16
        targetSdkVersion 28
        s true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0' 
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-messaging:20.1.7' 
}

flutter doctor -v颤振医生 -v

[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale en-US)
    • Flutter version 1.22.4 at C:\flutter
    • Framework revision 1aafb3a8b9 (4 days ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4


[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\8X\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.51.1)
    • VS Code at C:\Users\8X\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.16.0

[√] Connected device (1 available)
    • BKK LX2 (mobile) • BBPBB19130206058 • android-arm64 • Android 8.1.0 (API 27)

also there is a issues in flutter doctor result, working fine with is issues in android studio and visual studio code.颤振医生结果也存在问题,在 android studio 和 Visual Studio 代码中可以正常工作。

thank you for helping me.感谢你们对我的帮助。

您需要先安装 flutter 和 dart 到 android studio 然后配置选择更新更新您的版本然后去配置 agian 选择插件搜索 flutter,dart 并安装它们并重新启动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析 com.google.gms:google-services:3.0.0 - Could not resolve com.google.gms:google-services:3.0.0 找不到com.google.gms:google-services:9.0.0 - Could not find com.google.gms:google-services:9.0.0 找不到 com.google.gms:google-services:4.2.3 - Could not find com.google.gms:google-services:4.2.3 找不到com.google.gms:google-services:3.1.1 - Could not find com.google.gms:google-services:3.1.1 Bitrise:无法解析配置“:classpath”的所有工件无法解析com.google.gms:google-services:4.2.0 - Bitrise: Could not resolve all artifacts for configuration ':classpath' Could not resolve com.google.gms:google-services:4.2.0 使用 com.google.gms 时出错:google-services: 4.3.4 - Error using com.google.gms: google-services: 4.3.4 如何解决找不到 com.google.gms:google-services:4.1.0.? - How to solve Could not find com.google.gms:google-services:4.1.0.? 找不到com.google.gms:google-services:4.1.0。 在以下位置搜索: - Could not find com.google.gms:google-services:4.1.0. Searched in the following locations: Gradle 同步失败:找不到 com.google.gms:google-services:3.0.0 - Gradle sync failed: Could not find com.google.gms:google-services:3.0.0 收到错误消息“找不到com.google.gms:google-services:2.0.0-alpha6。” - Getting error message “Could not find com.google.gms:google-services:2.0.0-alpha6.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM