Home > database >  Can't run my project in android studio in my MacBook with M1 Pro chip
Can't run my project in android studio in my MacBook with M1 Pro chip

Time:01-12

I can't run my Android Studio project on my MacBook Pro with the M1 Pro chip but it does run on Windows and MacBook Pro with an Intel chip.

This is the error I have:

    > 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)

Here I got a lot of lines started at :

at org.codehaus.

or at groovy.lang.

or at 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

CodePudding user response:

Answer to my question

Use Room 2.4.0-alpha03 for those who use the M1 /M1 Pro chip.

def room_version = "2.4.0-alpha03"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
  •  Tags:  
  • Related