按照教程操作后无法创建Flutter应用

时间:2018-11-21 08:27:32

标签: android gradle flutter

我正在按照Flutter教程来创建Flutter应用。首先,使用flutter命令def execute(self, context): if self.bq_cursor is None: self.log.info( "Beginnging Execution." ) hook = BigQueryHook( bigquery_conn_id=self.bigquery_conn_id, use_legacy_sql=self.use_legacy_sql, delegate_to=self.delegate_to) conn = hook.get_conn() self.bq_cursor = conn.cursor() self.bq_cursor.run_query( self.sql, destination_dataset_table=self.destination_dataset_table, write_disposition=self.write_disposition, allow_large_results=self.allow_large_results, flatten_results=self.flatten_results, udf_config=self.udf_config, maximum_billing_tier=self.maximum_billing_tier, maximum_bytes_billed=self.maximum_bytes_billed, create_disposition=self.create_disposition, query_params=self.query_params, labels=self.labels, schema_update_options=self.schema_update_options, priority=self.priority, time_partitioning=self.time_partitioning ) self.log.info( "Executed: %s" % self.sql ) def on_kill(self): super(BigQueryOperator, self).on_kill() self.log.error( "Failed to Execute: %s" % self.sql ) if self.bq_cursor is not None: self.log.info('Canceling running query due to execution timeout') self.bq_cursor.cancel_query() 进行初始化。然后执行flutter create myflutter得到一些flutter run解决依赖关系错误,当我访问gradle时显示405网络错误,然后我将dl.google.com文件更改为访问正常的网站访问,我仍然失败。以下代码是我的配置: android \ build.gradle:

bulid.gradle

错误消息:

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        mavenCentral()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        mavenCentral()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Launching lib\main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Resolving dependencies... * Error running Gradle: ProcessException: Process "C:\Users\linla\AndroidStudioProjects\flutter_app2\android\gradlew.bat" exited abnormally: FAILURE: 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.1.0. Required by: project : > Could not resolve com.android.tools.build:gradle:3.1.0. > Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom'. > Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom'. Received status code 405 from server: Method Not Allowed > Could not resolve com.android.tools.build:gradle:3.1.0. > Could not get resource 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom'. > Could not GET 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.1.0/gradle-3.1.0.pom'. > maven.aliyun.com:80 failed to respond > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71. Required by: project : > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71. > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.pom'. > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.pom'. Received status code 405 from server: Method Not Allowed > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71. > Could not get resource 'http://maven.aliyun.com/nexus/content/groups/public/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.pom'. > Could not GET 'http://maven.aliyun.com/nexus/content/groups/public/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.71/kotlin-gradle-plugin-1.2.71.pom'. > maven.aliyun.com:80 failed to respond * 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 2s Command: C:\Users\linla\AndroidStudioProjects\flutter_app2\android\gradlew.bat app:properties Finished with error: Please review your Gradle project setup in the android/ folder. 日志消息

flutter doctor -v

可能是我的版本错误?或其他配置错误?

1 个答案:

答案 0 :(得分:1)

像这样更改网址:

....
    repositories {
        mavenCentral()
        maven { url 'https://maven.aliyun.com/repository/google/' }
    }
.
.
.
allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://maven.aliyun.com/repository/google/' }
    }
}

请原谅我的英语。我不能用中文发布答案。