Ionic Capacitor app give me lots of errors

前端 未结 5 979
自闭症患者
自闭症患者 2021-01-12 08:18

I\'m on Windows 10 and I\'ve created a Ionic 5.0.7 app with Capacitor 2.0.0.

I use this command to build app:

ionic build

After, I

相关标签:
5条回答
  • 2021-01-12 09:07

    This issue has been resolved in Capacitor version 2.1.2.

    https://github.com/ionic-team/capacitor/issues/3003

    Please update the Capacitor dependencies in package.json to version 2.1.2 and then in Android Studio click the button to sync the project with Gradle.

    "@capacitor/android": "^2.1.2",
    "@capacitor/core": "2.1.2",
    
    0 讨论(0)
  • 2021-01-12 09:07

    Switch to using gradle version 5.6.4. That did the trick for me. LazyConfigurationUsageContext doesn't have support in gradle versions 6.0+

    0 讨论(0)
  • 2021-01-12 09:10

    Update

    Check @Carl Pool 's answer They fixed it in the new capacitor Version, no need to downgrade anymore

    Old Answer

    To fix this downgrade Gradle and Gradle plugin in Android Studio.

    File -> Project Structure -> Project

    If you keep the plugin to 4.0.0 it will require a minimum Gradle version of 6 so put it back to a lower version like 3.6.3

    Version 6 of Gradle does not support LazyConfigurationUsageContext as mentionened by @NishaBhat, so use 5.6.4 instead.

    This issue currently has a ticket on Github: https://github.com/ionic-team/capacitor/issues/3003

    0 讨论(0)
  • 2021-01-12 09:20

    I was getting an error

    Cause: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext

    I solved by downgraded distributionUrl(gradle/wrapper/gradle-wrapper.properties) to https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

    it will give an error if above 6+

    0 讨论(0)
  • 2021-01-12 09:23

    Same problem.. had many issues:

    Errors and how I solved:

    Error 1. Gradle sync failed: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-5.6.4-all.zip
    Solution - Downloaded the zip file and stored in on my local in the \android\gradle\wrapper folder. Updated the distribution URL to: distributionUrl=./gradle-5.6.4-all.zip

    Error 2. java.lang.NoClassDefFoundError & java.lang.NoClassDefFoundError:
    Solution - Downloaded Gradle version 5.6.4 and updated the environment variables.

    Error 3. Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3

    Updated as per the image below

    0 讨论(0)
提交回复
热议问题