dependencies - in flutter whenever i add hive_flutter: ^1.1.0 or open_file: ^3.3.2 in pubspec.yaml i get error Incompatible magi

i have checked compatibility of the dependency and flutterand dart version also [uploading image for

i have checked compatibility of the dependency and flutter and dart version also [uploading image for more information of error][1] according to me it should work since all versions are compatible

Tried Downgrading the Dependencies to earlier versions, but the issue persists. What I Have Tried: Cleared Flutter's Cache:

bash Copy Edit flutter clean Deleted the .dart_tool directory and re-ran flutter pub get.

Checked for Dependency Conflicts by running:

bash Copy Edit flutter pub deps Tried Downgrading the Dependencies to earlier versions, but the issue persists.

Deleted and Reinstalled Flutter SDK completely.

Checked Java Version using:

bash Copy Edit java -version It's correctly set to Java 17 (which is required for the latest Flutter versions). [1]: .png

i have checked compatibility of the dependency and flutter and dart version also [uploading image for more information of error][1] according to me it should work since all versions are compatible

Tried Downgrading the Dependencies to earlier versions, but the issue persists. What I Have Tried: Cleared Flutter's Cache:

bash Copy Edit flutter clean Deleted the .dart_tool directory and re-ran flutter pub get.

Checked for Dependency Conflicts by running:

bash Copy Edit flutter pub deps Tried Downgrading the Dependencies to earlier versions, but the issue persists.

Deleted and Reinstalled Flutter SDK completely.

Checked Java Version using:

bash Copy Edit java -version It's correctly set to Java 17 (which is required for the latest Flutter versions). [1]: https://i.sstatic/3KRYBHul.png

Share Improve this question asked 19 hours ago Ritesh PatilRitesh Patil 11 bronze badge New contributor Ritesh Patil is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

The error you are getting "Incompatible magic value 0 in class file build_a0b42vr" usually occurs due to corruption in compiled Java/Kotlin class files or issues with the Gradle build system.

Run the following commands to remove any corrupted build files:

flutter clean
rm -rf android/.gradle
rm -rf android/.idea
rm -rf .dart_tool
rm -rf build
flutter pub get

Upgrade Gradle and Kotlin versions :

android/build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:8.0.2'
}

android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle./distributions/gradle-8.0-all.zip

android/build.gradle

ext.kotlin_version = '1.8.20'

final solution if none of the above works for you then create a fresh Flutter project and migrate your code over to rule out deeper project-specific corruption.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743763011a4502980.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信