首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在模拟器上运行颤振项目

无法在模拟器上运行颤振项目
EN

Stack Overflow用户
提问于 2022-07-29 08:20:38
回答 1查看 378关注 0票数 0

我下载了Android Studio花栗鼠2021.2.1修补程序1

我有java版本8 (build 1.8.0_341-b10)

我试图在vscode上运行main.dart (默认颤振程序),但它不起作用\

我已经运行了“颤栗医生”命令来检查任何问题,但是一切都是正确的。

错误列表是:

代码语言:javascript
运行
复制
FAILURE: Build failed with an exception.

* Where:
Build file 'G:\proj\android\app\build.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:aaptcompiler:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.lint:lint-gradle-api:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:gradle-api:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > androidx.databinding:databinding-compiler-common:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools.build:builder-model:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools:sdk-common:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools:common:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools.build:manifest-merger:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools.analytics-library:tracker:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.lint:lint-gradle-api:27.1.0 > com.android.tools.lint:lint-model:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools:sdklib:27.1.0 > com.android.tools:repository:27.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0 > com.android.tools:sdk-common:27.1.0 > com.android.tools.analytics-library:shared:27.1.0
      > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm:7.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
      > Could not resolve org.ow2.asm:asm:7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm/7.0/asm-7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-analysis:7.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
      > Could not resolve org.ow2.asm:asm-analysis:7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-commons:7.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
      > Could not resolve org.ow2.asm:asm-commons:7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-util:7.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
      > Could not resolve org.ow2.asm:asm-util:7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve net.sf.proguard:proguard-gradle:6.0.3.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
      > Could not resolve net.sf.proguard:proguard-gradle:6.0.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/net/sf/proguard/proguard-gradle/6.0.3/proguard-gradle-6.0.3.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/net/sf/proguard/proguard-gradle/6.0.3/proguard-gradle-6.0.3.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.tensorflow:tensorflow-lite-metadata:0.1.0-rc1.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0
      > Could not resolve org.tensorflow:tensorflow-lite-metadata:0.1.0-rc1.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc1/tensorflow-lite-metadata-0.1.0-rc1.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc1/tensorflow-lite-metadata-0.1.0-rc1.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-tree:7.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
      > Could not resolve org.ow2.asm:asm-tree:7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-tree/7.0/asm-tree-7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-tree/7.0/asm-tree-7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
   > Could not resolve it.unimi.dsi:fastutil:7.2.0.
     Required by:
         unspecified:unspecified:unspecified > com.android.tools.build:gradle:4.1.0 > com.android.tools.build:builder:4.1.0
      > Could not resolve it.unimi.dsi:fastutil:7.2.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.pom'.            > Could not GET 'https://repo.maven.apache.org/maven2/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake
..........

我的gradle包装属性:

代码语言:javascript
运行
复制
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

我的建造级:

代码语言:javascript
运行
复制
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'
}

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.flut"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

我读到了一些关于gradle不兼容的问题,但是我不太理解它,我也不明白为什么这些错误会发生。

更新:我尝试了一些修复,错误列表现在已经减少到以下内容

代码语言:javascript
运行
复制
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0.
     Required by:
         project :
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.0/kotlin-gradle-plugin-1.7.0.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.0/kotlin-gradle-plugin-1.7.0.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.4/userguide/build_environment.html#gradle_system_properties
                  > Remote host terminated the handshake

* 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 3s\

我认为TLS协议版本有一些问题。但我找不到很多细节。

EN

回答 1

Stack Overflow用户

发布于 2022-07-29 08:27:15

开启颤振终端并运行:

代码语言:javascript
运行
复制
flutter clean
flutter pub get

然后更新类路径:

代码语言:javascript
运行
复制
dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73163655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档