capacitor-community / photoviewer

⚡ Capacitor plugin to view table images with fullscreen and sharing capabilities.
MIT License
54 stars 27 forks source link

Issue with kotlin version when building project in android studio #34

Closed GiannisS closed 1 year ago

GiannisS commented 1 year ago

Describe the bug the below issue occurs when building project in android studio:

.gradle/caches/transforms-3/8d691be57362a94682b583b3ff3c7d44/transformed/jetified-TouchImageView-3.3-api.jar!/META-INF/touchview_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

Project versions

  1. @capacitor/android": "4.6.1",
  2. @capacitor/core": "^4.6.1"
  3. @capacitor-community/photoviewer": "^2.0.10"

Additional context In my android/build.gradle file i have this classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10' but still the problem persists

jepiqueau commented 1 year ago

@GiannisS you have to upgrade the kotlin version of your project to 1.8.0

GiannisS commented 1 year ago

@jepiqueau thank you for the fast reply. Does this also requires an sdk target version of 33?

Now i get the following errors:

  1. Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  2. Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  3. Dependency 'androidx.activity:activity-ktx:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  4. Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  5. Dependency 'androidx.core:core:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  6. Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

  7. Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

    :app is currently compiled against android-32.

and on every error i get this recommendation:

  Recommended action: Update this project to use a newer compileSdkVersion
  of at least 33, for example 33.

  Note that updating a library or application's compileSdkVersion (which
  allows newer APIs to be used) can be done separately from updating
  targetSdkVersion (which opts the app in to new runtime behavior) and
  minSdkVersion (which determines which devices the app can be installed
  on).

Removing the plugin solves every issue.

jepiqueau commented 1 year ago

@GiannisS build.gradle (Project android)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
  ext.kotlin_version = '1.8.0'

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath 'com.google.gms:google-services:4.3.13'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...

variables.gradle (Project android)

ext { minSdkVersion = 22 compileSdkVersion = 33 targetSdkVersion = 33 androidxActivityVersion = '1.4.0' androidxAppCompatVersion = '1.6.0' androidxCoordinatorLayoutVersion = '1.2.0' androidxCoreVersion = '1.8.0' androidxFragmentVersion = '1.4.1' junitVersion = '4.13.2' androidxJunitVersion = '1.1.5' androidxEspressoCoreVersion = '3.5.1' cordovaAndroidVersion = '10.1.1' coreSplashScreenVersion = '1.0.0-rc01' androidxWebkitVersion = '1.4.0' }


Gradle JDK 11
Android Gradle Plugin  Version 7.2.2
Gradle Version 7.4.2

you can have a look to [angular-photoviewer-app](https://github.com/jepiqueau/angular-photoviewer-app) version 1.1.2
bravao911 commented 1 year ago

@jepiqueau thank you for the fast reply. Does this also requires an sdk target version of 33?

Now i get the following errors:

  1. Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  2. Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  3. Dependency 'androidx.activity:activity-ktx:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  4. Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  5. Dependency 'androidx.core:core:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  6. Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  7. Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.

and on every error i get this recommendation:

  Recommended action: Update this project to use a newer compileSdkVersion
  of at least 33, for example 33.

  Note that updating a library or application's compileSdkVersion (which
  allows newer APIs to be used) can be done separately from updating
  targetSdkVersion (which opts the app in to new runtime behavior) and
  minSdkVersion (which determines which devices the app can be installed
  on).

Removing the plugin solves every issue.

@jepiqueau thank you for the fast reply. Does this also requires an sdk target version of 33?

Now i get the following errors:

  1. Dependency 'androidx.appcompat:appcompat-resources:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  2. Dependency 'androidx.appcompat:appcompat:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  3. Dependency 'androidx.activity:activity-ktx:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  4. Dependency 'androidx.activity:activity:1.6.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  5. Dependency 'androidx.core:core:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  6. Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.
  7. Dependency 'androidx.annotation:annotation-experimental:1.3.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.

and on every error i get this recommendation:

  Recommended action: Update this project to use a newer compileSdkVersion
  of at least 33, for example 33.

  Note that updating a library or application's compileSdkVersion (which
  allows newer APIs to be used) can be done separately from updating
  targetSdkVersion (which opts the app in to new runtime behavior) and
  minSdkVersion (which determines which devices the app can be installed
  on).

Removing the plugin solves every issue.

l have same issue

jepiqueau commented 1 year ago

@GiannisS yes see wha i sent to you earlier fir the variables.gradle

GiannisS commented 1 year ago

@jepiqueau Thanks for you answers! That last comment wasn't mine. @bravao911 commented and said he has the same problem. I finally managed to configure the plugin to work correctly with your suggestions on variables.gradle and build.android. Thank you again. It's kinda weird though that it forces me to go on android sdk version 33 but it's fine!

bravao911 commented 1 year ago

l have followed all steps that you mentioned and does not working.

l have npm uninstall @capacitor-community/photoviewer andnpx cap sync . Then l installed npm install @capacitor-community/photoviewer@next https://github.com/capacitor-community/photoviewer/blob/main/info_releases.md and its working fine on ios and android .

jepiqueau commented 1 year ago

@bravao911 you shoud not install @next but @latest

jepiqueau commented 1 year ago

@GiannisS sorry for this. Hope this move to API 33 will not break anything in your development

GiannisS commented 1 year ago

@jepiqueau No problem it seems all worked seamlessly. Thank you

bravao911 commented 1 year ago

@bravao911 you shoud not install @next but @latest

l dont know . l did that and his working fine now .

jepiqueau commented 1 year ago

@bravao911 Release @next is release 2.0.0-0 where the latest is 2.0.10

jepiqueau commented 1 year ago

@GiannisS @bravao911 As i do not hear anything, i assume that this is fixed on your side so i close the issue