我无法在装有M1 Pro芯片的MacBook Pro上运行我的Android Studio项目,但它确实在装有英特尔芯片的Windows和MacBook Pro中运行。
这就是我的错误:
> Task :app:compileDebugJavaWithJavac FAILED
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.ExceptionInInitializerError
* 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.
Here is stacktrace result:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/User/Downloads/FindMeHomeApp-master 2/app/build.gradle'
* What went wrong:
Could not compile build file '/Users/User/Downloads/FindMeHomeApp-master 2/app/build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:189)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:170)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:156)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:277)
这里我有很多行开始于:
网址:org.codehaus.
或在groovy.lang.
或在org.gradle.
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:833)
1 error
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
回答我的问题
对于使用M1/M1 Pro芯片的用户,请使用2.4.0-alpha03室。
def room_version = "2.4.0-alpha03"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"