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
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.
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
If you using mac m1
First, open the terminal after copy paste this command
softwareupdate --install-rosetta
and after that, press "a"
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
}
I'm not 100% sure but seems like updating AGP to 7.1.0 solves the issue.
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.
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.
My issue was other way around. My Mac was on Intel chip but looks like I had downloaded and pointed to JDK 17 that was meant for M1 Chip. I had to go to Android Studio -> Preferences -> Gradle -> Gradle JDK
and selected an embedded JDK.
It seems like the AGP need to upgrade. After upgrading AGP to 7.0.4 , and then it resolve the issue
© 2022 - 2024 — McMap. All rights reserved.
softwareupdate --install-rosetta
Looks like ADB has not been built for the ARM chip set yet. See issuetracker.google.com/issues/160004878 – Cheke