Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution failed for task ':photo_manager:compileDebugKotlin'. #561

Closed
AlexV525 opened this issue Jul 15, 2021 · 0 comments
Closed

Execution failed for task ':photo_manager:compileDebugKotlin'. #561

AlexV525 opened this issue Jul 15, 2021 · 0 comments

Comments

@AlexV525
Copy link
Member

AlexV525 commented Jul 15, 2021

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.

@fluttercandies fluttercandies locked as resolved and limited conversation to collaborators Jul 15, 2021
@AlexV525 AlexV525 pinned this issue Jul 15, 2021
@AlexV525 AlexV525 changed the title Build failed with Unresolved reference: R Execution failed for task ':photo_manager:compileDebugKotlin'. Jul 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant