'Android Studio-- Cause: error=86, Bad CPU type in executable
Solution 1:[1]
Finally I solved this by a little change.
goto the error module and changed the buildToolsVersion to anther(bigger version) in build.gradle file.
rebuild again, the error disappeared.
Solution 2:[2]
ADB doesn't support ARM, it needs Rosetta
to run.
I fixed this issue by installing Rosetta. Open Terminal and run the following command:
softwareupdate --install-rosetta
Solution 3:[3]
I fixed this error by installing rosetta. Try running this command in your terminal
softwareupdate --install-rosetta
Solution 4:[4]
Upgrading buildToolsVersion is not work for me, but after upgraded gradle version, the error disappeared.
buildscript {
repositories {
jcenter()
google() <--don't forget to add this
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3' <--upgrade here
}
Solution 5:[5]
If you using mac m1
First, open the terminal after copy paste this command
softwareupdate --install-rosetta
and after that, press "a"
Solution 6:[6]
Android Studio has built-in installer for M1 ARM64 architecture compatible Java:
Android Studio -> Preferences -> Gradle -> Gradle JDK -> Download JDK...
You feel free to select anything that have aarch64
tag. Azul for example
After that, run ./gradlew clean
to see, that your project is used fresh ARM supported JDK.
But, for some cases (like adb
) you need to install rosetta. Other things, like building project going directly through ARM without binary translator.
Solution 7:[7]
I'm not 100% sure but seems like updating AGP to 7.1.0 solves the issue.
Solution 8:[8]
Following working fine for Mac M1 users (If ARM version of android studio is installed --> android-studio-2021.x.x.xx-mac_arm.dmg)):
Open terminal and install rosetta:
softwareupdate --install-rosetta
press a and the press enter(return) key.
Now rebuild or sync your project. It will work smooth.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Michael Yang |
Solution 2 | Noelia |
Solution 3 | MOhan |
Solution 4 | Lai Lee |
Solution 5 | Suraj Rao |
Solution 6 | whalemare |
Solution 7 | Arkadii Ivanov |
Solution 8 | Abhishek Bharti |