简体   繁体   English

flutter 错误:任务“:flutter_inappwebview:compileDebugJavaWithJavac”执行失败

[英]flutter error: Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'

when I am going to install my project in my mobile device then I got error to chenge compileSDKVersion 33.当我要在我的移动设备上安装我的项目时,我收到了 chenge compileSDKVersion 33 的错误。

After changing my compileSDKVersion 33 from compileSDKVersion 32, Then I got this error Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'.从 compileSDKVersion 32 更改我的 compileSDKVersion 33 后,我收到此错误 Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'。

This is my build.gradle file.这是我的 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'
}

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'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

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 "org.mycwc"
        minSdkVersion 19
        targetSdkVersion 30
        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']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:29.0.3')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.facebook.android:facebook-login:latest.release'
    implementation 'com.facebook.android:facebook-android-sdk:latest.release'

}

I got this error after changing compileSDKVersion 33 from compileSDKVersion 32.从 compileSDKVersion 32 更改 compileSDKVersion 33 后出现此错误。

C:\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
C:\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
C:\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
C:\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
C:\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
C:\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
C:\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 5m 2s
Exception: Gradle task assembleDebug failed with exit code 1

Same issue, I tried these command flutter clean flutter pub upgrade flutter pub get but still not working同样的问题,我尝试了这些命令flutter clean flutter pub upgrade flutter pub get但仍然无法正常工作

  • I fixed the issue with:我解决了这个问题:
  1. upgrade my gradle version to 7.1.4将我的 gradle 版本升级到7.1.4

  2. upgrade gradle wrapper to 7.4将 gradle 包装器升级到7.4

  3. upgrade kotlin version to 1.6.10升级kotlin版本到1.6.10

Ref: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1299#issuecomment-1240159079参考: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1299#issuecomment-1240159079

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter - 任务 ':connectivity:compileDebugJavaWithJavac' 执行失败 - Flutter - Execution failed for task ':connectivity:compileDebugJavaWithJavac' flutter 中的任务 ':image_picker:compileDebugJavaWithJavac' 执行失败 - Execution failed for task ':image_picker:compileDebugJavaWithJavac' in flutter Flutter 和 Firebase:任务 ':firebase_auth:compileDebugJavaWithJavac' 执行失败 - Flutter and Firebase: Execution failed for task ':firebase_auth:compileDebugJavaWithJavac' Flutter:任务'执行失败':cloud_firestore:compileDebugJavaWithJavac' - Flutter: Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac' Flutter - 任务“:cloud_firestore:compileDebugJavaWithJavac”执行失败 - Flutter - Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac' Flutter 任务“:android_intent:compileDebugJavaWithJavac”执行失败 - Flutter Execution failed for task ':android_intent:compileDebugJavaWithJavac' 如何解决“任务执行失败':flutter_keyboard_visibility:compileDebugJavaWithJavac'”错误? - How to resolve "Execution failed for task':flutter_keyboard_visibility:compileDebugJavaWithJavac'" error? 将flutter_downloader与flutter_inappwebview一起使用-带有重定向代码的响应 - Using flutter_downloader with flutter_inappwebview - Response with redirection code Gradle 错误:任务 ':app:compileDebugJavaWithJavac' 执行失败 - Gradle Error: Execution failed for task ':app:compileDebugJavaWithJavac' 任务'执行失败':compileDebugJavaWithJavac - Execution failed for task ':compileDebugJavaWithJavac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM