我已经下载了一个flutter提醒项目,并在android studio中打开了它,并进行了运行它所需的更改,但是app / gradle.build中无法解决错误。我已经将flutter升级到了最新版本,例如android studio
存在错误的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'
}
我认为这里的错误
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
以及向我显示的错误
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
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
#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
答案 0 :(得分:1)
您的语言和导航至源/项目文件时遇到问题。我认为构建脚本无法加载所有资源。
* 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
从下一行开始调查。如您所见, 6261e20 应该是一些名称,但由于解码而被省略。
Build file 'C:\Users\user1\AndroidStudioProjects\tuannguyendotme-flutter_todo-
6261e20\android\app\build.gradle' line: 23