I get this error when I want to run "flutter" project from my phone with "visual studio code".
how can i solve it?
PROBLEM
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:path_provider_android:parseDebugLocalResources’.
Could not resolve all files for configuration ‘:path_provider_android:androidApis’.
Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for PlatformAttrTransform: C:UsersHpAppDataLocalAndroidsdkplatformsandroid-31android.jar.
> C:UsersHpAppDataLocalAndroidsdkplatformsandroid-31android.jar
- Try:
Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.
- Get more help at https://help.gradle.org
2
Answers
you probably have to check if the version of the jdk you use is installed correctly
When the.jar file mentioned above was overlooked, this issue would arise. You must take a number of actions in order to resolve this issue.
step 1:
Android Studio > SDK Manager > SDK Platforms
Android Studio SDK Manager
step 2:
Select only Android 11.0(R) - API Level 30
(Uncheck other API Levels to Uninstall other API Levels temporary. Special API Level 31, 33)
Apply & Ok
step 3:
flutter clean
step 4:
cd android
step 5:
./gradlew clean
step 6:
./gradlew build
->FAILURE: Build failed with an exception.
step 7:
./gradlew --stacktrace
->BUILD SUCCESSFUL
step 8:
flutter run
Ensure that your development device is connected to a more reliable internet connection.