有人能帮我诊断一下什么是错误吗?我只是不明白是什么导致了这个错误。很抱歉,我这周刚开始学习颤栗,并被分配到一个项目(只有几天的时间学习)。
根据我的研究,这可能是由于一些不正确的版本。尽管我尝试过更改..app/build.gradle中的版本。但我解决不了这个问题。我试过这些related-stackoverflow,但对我没有用。
我也尝试从一个频道移动到另一个频道,并运行升级,但同样的错误抛出。
完整的错误消息出现在代码段中:(为了缩短堆栈描述,我将其暂时隐藏在代码段中。一旦问题解决了,我会更新。)
user76@user76:~/Documents/Workspace/office/fluter-office(develop)$ flutter run
Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Building with Flutter multidex support enabled.
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:280: error: cannot find symbol
settings.setAppCachePath(options.appCachePath);
^
symbol: method setAppCachePath(String)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:494: error: cannot find symbol
settings.setAppCacheEnabled(false);
^
symbol: method setAppCacheEnabled(boolean)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:504: error: cannot find symbol
settings.setAppCacheEnabled(true);
^
symbol: method setAppCacheEnabled(boolean)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:515: error: cannot find symbol
settings.setAppCachePath(ctx.getCacheDir().getAbsolutePath());
^
symbol: method setAppCachePath(String)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:517: error: cannot find symbol
settings.setAppCacheEnabled(true);
^
symbol: method setAppCacheEnabled(boolean)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:521: error: cannot find symbol
settings.setAppCacheEnabled(false);
^
symbol: method setAppCacheEnabled(boolean)
location: variable settings of type WebSettings
/home/user76/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:767: error: cannot find symbol
settings.setAppCachePath(newOptions.appCachePath);
^
symbol: method setAppCachePath(String)
location: variable settings of type WebSettings
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 5s
Running Gradle task 'assembleDebug'... 6.4s
Exception: Gradle task assembleDebug failed with exit code 1
我的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 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'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
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.wcc.office_app_android"
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
applicationIdSuffix ".dev"
versionNameSuffix "-Dev"
}
stag {
dimension "environment"
applicationIdSuffix ".stag"
versionNameSuffix "-Stag"
}
prod {
dimension "environment"
}
}
lintOptions {
checkReleaseBuilds false
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
}
我的规格
Java 18.0.2.1 2022-08-18 Java(TM) SE运行时环境(build 18.0.2.1+1-1) java HotSpot(TM) 64位服务器VM (build 18.0.2.1+1-1,混合模式,共享)建于5月19日,2022年安卓SDK构建- Tools 33 Android模拟器33.3.10 Android SDK平台- Tools 33.0.3 Android SDK命令-行工具(最新)安装了颤振3.3.0·通道稳定·https://github.com/flutter/flutter.git框架·修订ffccd96b62 (33小时前)·2022-08-29 17:28:57 -0700引擎·修订5e9e0e0a8工具·Dart 2.18.0·DevTools 2.15.0
发布于 2022-08-31 10:37:26
你试过做flutter clean然后做flutter pub get吗?
这看起来微不足道,但实际上它修复了我的许多bug。
flutter doctor也可以提供有用的信息。
https://stackoverflow.com/questions/73554137
复制相似问题