Android Studio throws an error while building the project.
the error is :
Cause: error=86, Bad CPU type in executable.
Bad CPU type in executable --> Can not run command xxx/aapt
Android Studio throws an error while building the project.
the error is :
Cause: error=86, Bad CPU type in executable.
Bad CPU type in executable --> Can not run command xxx/aapt
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
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.
I fixed this error by installing rosetta. Try running this command in your terminal
softwareupdate --install-rosetta
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
}
If you using mac m1
First, open the terminal after copy paste this command
softwareupdate --install-rosetta
and after that, press "a"
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.
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.