第一个颤振应用程序(Android Studio)的问题

Posted

技术标签:

【中文标题】第一个颤振应用程序(Android Studio)的问题【英文标题】:Problem with first flutter app (Android Studio) 【发布时间】:2019-04-03 02:55:06 【问题描述】:

我无法在 Android Studio 中运行我的第一个 Flutter 应用

Flutter Doctor -v

[√] Flutter (Channel beta, v0enter code here.9.4, on Microsoft Windows [Version 10.0.17134.345], locale en-US)enter code here
• Flutter version 0.9.4 at C:\development\flutter`enter code here`
• Framework revision f37c235 (5 weeks ago), 2018-09-25 17:45:40 -0400
• Engine revision 74625aed32
• Dart version 2.1.0-dev.5.0.flutter-a2eb050044

[√] android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\Meteor\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = C:\Users\Meteor\AppData\Local\Android
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.

[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)

• No issues found!

Android Studio(控制台)

Performing hot restart...
Syncing files to device Android SDK built for x86...

Error running Gradle:
Exit code 1 from: C:\Users\Meteor\AndroidStudioProjects\my_flutter_app\android\gradlew.bat app:properties:
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Download /dl/android/maven2/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom
Download /dl/android/maven2/com/android/tools/build/gradle-core/3.1.2/gradle-core-3.1.2.pom
Download /dl/android/maven2/com/android/tools/build/bundletool/0.1.0-alpha01/bundletool-0.1.0-alpha01.pom

Download /com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.pom
Download /com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar
Project evaluation failed including an error in afterEvaluate . Run with --stacktrace for details of the afterEvaluate  error.

FAILURE: Build failed with an exception.

Where:
Build file 'C:\Users\Meteor\AndroidStudioProjects\my_flutter_app\android\app\build.gradle' line: 25

What went wrong:
A problem occurred evaluating project ':app'.

Could not resolve all files for configuration 'classpath'.
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

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 7m 57s

Finished with error: Please review your Gradle project setup in the android/ folder.

【问题讨论】:

couldn't locate lint-gradle-api-26.1.2.jar for flutter project的可能重复 【参考方案1】:

尝试在 Android Studio 中将 android 目录作为 Android 项目打开,然后打开 \app\build.gradle 并单击同步按钮。

【讨论】:

【参考方案2】:
Download /dl/android/maven2/com/android/tools/build/gradle-core/3.1.2/gradle-core-3.1.2.pom

这表明您使用的是旧版本的 Gradle。尝试升级到 3.2.0。

【讨论】:

以上是关于第一个颤振应用程序(Android Studio)的问题的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio 未正确构建颤振应用程序

在 Android Studio 中构建文件时出现颤振错误

如何将颤振应用程序从 android studio 导出到 Xcode?

android studio 的模拟器没有启动颤振应用程序(错误)

颤振医生找不到android studio

颤振或普通android项目中的android studio arctic fox bug(类已加密)