今天我正在我的项目工作突然我的笔记本电脑挂了然后我做了我的笔记本电脑重新启动,然后现在我试图运行我的项目再次n再次我得到这个错误。我不知道如何解决这个问题。(我已经尝试过flutter clean和flutter pub cache clean)
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':fluttertoast'.
> Could not load compiled classes for build file 'C:\Users\dell\AppData\Local\Pub\Cache\hosted\pub.dev\fluttertoast-8.2.2\android\build.gradle' from cache.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':fluttertoast' of type org.gradle.api.Project.
> Could not get unknown property 'android' for project ':fluttertoast' of type org.gradle.api.Project.
* 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 8s
Exception: Gradle task assembleDebug failed with exit code 1
Android/build.gradle
buildscript {
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
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 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 33
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.flutter.pizzamenia"
minSdkVersion 21
targetSdkVersion 33
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"
implementation "com.squareup.okhttp3:okhttp:4.8.0"
}
pubspec.ymal
name: pizzamenia
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.5
pin_code_fields: ^7.4.0
carousel_slider: ^4.2.1
google_fonts: ^4.0.3
fluttertoast: ^8.2.0
dropdown_button2: ^1.9.3
google_maps_flutter: ^2.2.3
flutter_google_places: ^0.3.0
dotted_border: ^2.0.0+3
flutter_rating_bar: ^4.0.1
flutter_bloc: ^8.1.2
connectivity_plus: ^3.0.3
shared_preferences: ^2.0.18
dio: ^5.0.1
skeletons: ^0.0.3
geolocator: ^9.0.2
geocoding: ^2.1.0
sqflite: ^2.2.6
path_provider: ^2.0.14
intl: ^0.17.0
paytm_allinonesdk: ^1.2.1
webview_flutter: ^4.2.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.12.0
package_info_plus: ^4.0.1
flutter_launcher_name:
name: Rominus Pizza
#flutter_native_splash:
# image: assets/splash.png
# color: "ffffff"
flutter_icons:
android: "ic_launcher"
ios: true
image_path: "assets/appLogo.jpg"
flutter:
uses-material-design: true
assets:
- assets/
- assets/BannerImages/
- assets/HomeMenu/
# fonts:
# - family: Poppins
# fonts:
# - asset: fonts/Poppins-Regular.ttf
# - asset: fonts/Poppins-Medium.ttf
# weight: 500
1条答案
按热度按时间sh7euo9m1#
您遇到的错误似乎与项目中
fluttertoast
包的配置有关。似乎是fluttertoast
软件包的build.gradle
文件导致了此问题。要解决此问题,您可以尝试以下步骤:
1.从
pubspec.yaml
文件中删除fluttertoast
软件包:1.保存
pubspec.yaml
文件,并在项目的根目录中运行以下命令以删除该软件包:1.成功删除
fluttertoast
包后,将其重新添加到pubspec.yaml
文件中:1.保存
pubspec.yaml
文件,并在项目的根目录中运行以下命令以获取和更新包:1.更新包后,请再次尝试运行项目:
通过执行这些步骤,您应该能够解决与
fluttertoast
软件包相关的问题。如果问题仍然存在,请提供可能有助于进一步诊断问题的任何其他错误消息或详细信息。