fluttercandies/flutter_photo_manager

Execution failed for task ':photo_manager:compileDebugKotlin'.

AlexV525 opened this issue · 0 comments

Redeclaration: *

Run flutter clean.

e: path/to/photo_manager/android/src/main/kotlin/com/fluttercandies/photo_manager/core/utils/CommonExt.kt: (10, 1): Conflicting overloads: public fun String.checkDirs(): Unit defined in com.fluttercandies.photo_manager.core.utils in file CommonExt.kt, public fun String.checkDirs(): Unit defined in com.fluttercandies.photo_manager.core.utils in file CommonExt.kt
e: path/to/photo_manager/android/src/main/kotlin/com/fluttercandies/photo_manager/core/utils/CommonExt.kt: (17, 1): Conflicting overloads: public fun InputStream.getOrientationDegrees(): Int defined in com.fluttercandies.photo_manager.core.utils in file CommonExt.kt, public fun InputStream.getOrientationDegrees(): Int defined in com.fluttercandies.photo_manager.core.utils in file CommonExt.kt
e: path/to/photo_manager/android/src/main/kotlin/com/fluttercandies/photo_manager/core/utils/IDBUtils.kt: (22, 11): Redeclaration: IDBUtils
e: path/to/photo_manager/android/src/main/kotlin/com/fluttercandies/photo_manager/permission/PermissionsUtils.kt: (24, 7): Redeclaration: PermissionsUtils
e: path/to/photo_manager/android/src/main/kotlin/com/fluttercandies/photo_manager/util/LogUtils.kt: (8, 8): Redeclaration: LogUtils

FAILURE: Build failed with an exception.

Unresolved reference

Two steps to solve this issue:

  • Raise the compileSdkVersion and targetSdkVersion to 33 in the android/app/build.gradle.
  • Check if android/app/build.gradle contains apply plugin: 'kotlin-android'. Add this line if it's not contained, and the file should be like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
e: path/to/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/PhotoManagerDeleteManager.kt: (116, 36): Unresolved reference: R
e: path/to/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/PhotoManagerDeleteManager.kt: (119, 36): Unresolved reference: createTrashRequest
e: path/to/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/PhotoManagerPlugin.kt: (341, 84): Unresolved reference: R
e: path/to/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/utils/Android30DbUtils.kt: (34, 34): Unresolved reference: R
e: <path>/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/utils/IDBUtils.kt: (27, 67): Unresolved reference: R

FAILURE: Build failed with an exception.

XXX was compiled with an incompatible version of Kotlin

Two steps to solve this issue:

  • Raise the ext.kotlin_version in android/build.gradle to 1.7.0 or a newer version.
  • Raise the gradle version in android/gradle/wrapper/gradle-wrapper.properties to 7.3.3 or a newer version.
``` e: path/to/photo_manager-x.y.z/android/src/main/kotlin/com/fluttercandies/photo_manager/core/PhotoManagerDeleteManager.kt: (38, 9): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16. The class is loaded from /path/to/jetified-kotlin-stdlib-1.5.21.jar!/kotlin/Unit.class ```

Unresolved reference: lowercase

Raise the ext.kotlin_version in android/build.gradle to 1.6.10 or a newer version.