Absolutely the same problem as it was mentioned in #253, but with correctly setted compileSdkVersion.
Compilation should be completed without any errors
flutter clean
flutter pub get
flutter pub run build_runner build -v --delete-conflicting-outputs
flutter run
Compilation failed with:
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:58: error: cannot find symbol
status = Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:246: error: cannot find symbol
if (permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:260: error: cannot find symbol
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:262: error: cannot find symbol
Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
^
symbol: variable ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
location: class Settings
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:332: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:361: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:365: error: cannot find symbol
return Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:64: error: cannot find symbol
case Manifest.permission.MANAGE_EXTERNAL_STORAGE:
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:229: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:229: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:230: error: cannot find symbol
permissionNames.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE);
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
11 errors
FAILURE: Build failed with an exception.
flutter --version
Flutter 2.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 02c026b03c (2 weeks ago) • 2021-05-27 12:24:44 -0700
Engine • revision 0fdb562ac8
Tools • Dart 2.13.1
flutter --doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19043.985], locale ru-RU)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.3)
[√] VS Code (version 1.56.2)
[√] Connected device (3 available)
! Doctor found issues in 1 category.
gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
android.buildTypes.release.ndk.debugSymbolLevel=FULL
android/app/build.gradle
compileSdkVersion 30
defaultConfig
minSdkVersion 23
targetSdkVersion 30
Version: 8.1.0
Platform:
Same problem here, in my case, minSdk is 29
Hi @0xdecade,
I think the problem here might be related to the fact that you haven't accepted the Android SDK licenses yet, as explained in the flutter doctor -v output. Try running flutter doctor --android-licenses and accept all the licenses prompted. After that try to compile the application again.
Otherwise from what you posted the configuration looks good. In most cases this error is caused when the compileSdkVersion is not configured correctly. Since version 7.0.0 of the plugin this should be set to version 30 (note that it is not necessary to update the minSdkVersion or targetSdkVersion for this plugin to work).
Could you please verify if this helps?
@mvanbeusekom Now then I accepted licenses with flutter doctor --android-licenses I haven't founded issues:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19043.985], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.3)
[√] VS Code (version 1.56.2)
[√] Connected device (3 available)
• No issues found!
But the problem is still there:
Using hardware rendering with device Android SDK built for x86 64. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Signing with key.properties
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:carousel_slider
- package:flutter_slider_indicator
- package:f_datetimerangepicker
- package:intent
- package:wifi_hunter
- package:wifi_info_plugin
For solutions, see https://dart.dev/go/unsound-null-safety
FAILURE: Build failed with an exception.
* Where:
Script 'C:\tools\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\tools\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 55s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 57,2s
Exception: Gradle task assembleDebug failed with exit code 1
PS C:\Users\Roman\IdeaProjects\ramnet_app> clear
PS C:\Users\Roman\IdeaProjects\ramnet_app> flutter run --no-sound-null-safety
Using hardware rendering with device Android SDK built for x86 64. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Signing with key.properties
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:58: error: cannot find symbol
status = Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:246: error: cannot find symbol
if (permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:260: error: cannot find symbol
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:262: error: cannot find symbol
Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
^
symbol: variable ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
location: class Settings
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:332: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:361: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:365: error: cannot find symbol
return Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:64: error: cannot find symbol
case Manifest.permission.MANAGE_EXTERNAL_STORAGE:
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:229: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable R
location: class VERSION_CODES
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:229: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.1.0\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:230: error: cannot find symbol
permissionNames.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE);
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
11 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':permission_handler: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 43s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 45,1s
Exception: Gradle task assembleDebug failed with exit code 1
@0xdecade could you list the contents of both your android/build.gradle and android/app/build.gradle files?
@mvanbeusekom
It's looks like the compile SDK version is different in both files. Does it matter?
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Example existing classpath
classpath 'com.android.tools.build:gradle:3.5.3'
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
afterEvaluate { project ->
android {
compileSdkVersion 29
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android/app/build.graddle
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 FileNotFoundException("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 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.jniLibs.srcDirs = ['libs']
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "ru.ramnet.ramnetapp"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
if (keystorePropertiesFile.exists()) {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
} else {
println("key.properties not found")
}
}
}
buildTypes {
release {
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
println "Signing with key.properties"
} else {
signingConfig signingConfigs.debug
println "Signing with debug keys"
}
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-messaging:21.0.0'
}
@mvanbeusekom @Pitazzo
Yes, it's really matter, so the problem can be solved by changing compileSdkVersion from 29 to 30 in android/build.graddle
afterEvaluate { project ->
android {
compileSdkVersion 30
}
}
I think it is better to set compileSdkVersion 29
I think it is better to set compileSdkVersion 29
@szuwest Yes that is possible but then you should stick to a version below 7.0.0. Since version 7.0.0 of the permission_handler we introduced new permissions which require compileSdkVersion to be set to 30 as they are not available in version 29 and earlier.
If you do want to use version 7.0.0 or higher and you don't update the compileSdkVersion you will get the error described above.
@0xdecade Thanks you for reporting back. I will close this issue now as it seems to be resolved.
Most helpful comment
@mvanbeusekom @Pitazzo
Yes, it's really matter, so the problem can be solved by changing compileSdkVersion from 29 to 30 in android/build.graddle