Can't build android demo
Closed this issue · 2 comments
flutter run
FAILURE: Build failed with an exception.
-
What went wrong:
Value '/Users/abandon/Library/Java/JavaVirtualMachines/corretto-11.0.20/Contents/Home' given for org.gradle.java.home Gradle property is invalid (Java home supplied is invalid) -
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
Running Gradle task 'assembleDebug'... 397ms
Exception: Gradle task assembleDebug failed with exit code 1
把gradle.properties中的org.gradle.java.home=/Users/abandon/Library/Java/JavaVirtualMachines/corretto-11.0.20/Contents/Home
刪掉後
One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to /Users/zhongyuedeng/beauty_cam/example/android/app/build.gradle:
android {
ndkVersion "25.2.9519653"
...
}
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':beauty_cam:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':beauty_cam:debugCompileClasspath'.
Failed to transform flutter.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /Users/zhongyuedeng/flutter_sdk/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar.
> Transform's input file does not exist: /Users/zhongyuedeng/flutter_sdk/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar. (See https://issuetracker.google.com/issues/158753935)
- 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
BUILD FAILED in 9s
Running Gradle task 'assembleDebug'... 10.0s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ This issue appears to be flutter/flutter#58247. │
│ Fix this issue by adding the following to the file /Users/zhongyuedeng/beauty_cam/example/android/app/build.gradle: │
│ android { │
│ lintOptions { │
│ checkReleaseBuilds false │
│ } │
│ } │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
修改了ndkVersion跟lintOption 後 => 仍然得到lintOption error
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':beauty_cam:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':beauty_cam:debugCompileClasspath'.
Failed to transform flutter.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /Users/zhongyuedeng/flutter_sdk/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar.
> Transform's input file does not exist: /Users/zhongyuedeng/flutter_sdk/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar. (See https://issuetracker.google.com/issues/158753935)
- 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
BUILD FAILED in 9s
Running Gradle task 'assembleDebug'... 10.0s
┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ This issue appears to be flutter/flutter#58247. │
│ Fix this issue by adding the following to the file /Users/zhongyuedeng/beauty_cam/example/android/app/build.gradle: │
│ android { │
│ lintOptions { │
│ checkReleaseBuilds false │
│ } │
│ } │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
flutter doctor 無異常
java -version
java version "17.0.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)
在Windows跟Macos上都無法Build android demo
解決了 =>
flutter precache