Reputation: 2188
when I am going to install my project in my mobile device then I got error to chenge compileSDKVersion 33.
After changing my compileSDKVersion 33 from compileSDKVersion 32, Then I got this error Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'.
This is my build.gradle file.
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.
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
Upvotes: 7
Views: 6325
Reputation: 1191
upgrade my gradle version to 7.1.4
upgrade gradle wrapper to 7.4
upgrade kotlin version to 1.6.10
Ref: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1299#issuecomment-1240159079
Upvotes: 3
Reputation: 51
Checkout your gradle plugin is compatible with your gradle version or not.
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
I have faced the same error when my gradle version was 6.7.1 while my plugin was 4.1.0. Updating the plugin to 4.2.0 solved it for me.
The gradle plugin version is located on android/build.gradle as classpath 'com.android.tools.build:gradle:{your version}' on the dependencies.
The gradle version is located on android/gradle/wrapper/gradle-wrapper.properties under distributionUrl.
Hopes it will help you.
Upvotes: 2