[英]Cant run flutter project in android studio
I have downloaded a reminder flutter project and opened it in android studio and made the changes required to run it but there is an error cant solve in app/gradle.build i have upgraded flutter to the latest version and so as android studio我已经下载了一个提醒 flutter 项目并在 android studio 中打开它并进行了运行它所需的更改但是在 app/gradle.build 中有一个错误无法解决我已将 flutter 升级到最新版本,因此 android studio
the gradle.build file that has an error有错误的 gradle.build 文件
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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "me.tuannguyen.fluttertodo"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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 {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.3.0'
}
the error here i think我认为这里的错误
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
and the error that shows to me以及显示给我的错误
Launching lib\main.dart on Redmi Note 7 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\app\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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 1s
Command: C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
Gradle.build Gradle.build
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties gradle-wrapper.properties
#Wed Sep 26 21:25:02 ICT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
You have issue with your language and navigation to the source/project files.您的语言和对源/项目文件的导航有问题。 I think building scripts just cannot load all the resources.
我认为构建脚本无法加载所有资源。
* Where:
Build file 'C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\app\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
Start your investigation with the next line.从下一行开始您的调查。 As you can see 6261e20 should be some name, but omitted because of decoding.
如您所见, 6261e20应该是某个名称,但由于解码而省略。
Build file 'C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\app\build.gradle' line: 23
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.