Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facing an error when running my android app on an emulator

Hi I'm just starting to learn how to code on android studio.

After running npm run android on my terminal, I've faced some errors which I could not solve.

The error message is as follows :

XXXX-MacBook-Pro:first-app XXXX$ npm run android

[email protected] android /Users/XXXX/Desktop/React Native/first-app react-native run-android

Scanning folders for symlinks in /Users/XXXX/Desktop/React Native/first-app/node_modules (8ms) Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

What went wrong: Could not resolve all files for configuration ':app:_internal_aapt2_binary'. Could not find com.android.tools.build:aapt2:3.2.0-4818971. Searched in the following locations: file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar Required by: project :app

BUILD FAILED in 3s 11 actionable tasks: 1 executed, 10 up-to-date Could not install the app on the device, read the error above for details.

I hope you guys can help me with it.

like image 884
Sean Avatar asked Sep 26 '18 13:09

Sean


People also ask

How do I fix Android emulator won't Load my App?

The adb command is now located in the platform-tools directory under your Android SDK installation, so I found it there, then followed these steps: Leave Eclipse running. Open a Terminal window, and run that "adb kill-server" command. Run my Android app through Eclipse again. For me, this solved my 'Android emulator won't load my app' problem.

Why can't I Run my antivirus software on the Android emulator?

Some antivirus software may be incompatible with the Android Emulator. If you're using Avast software and are having trouble running the Android Emulator, try disabling Use nested virtualization when available and Enable Hardware assisted virtualization in the Avast Troubleshooting settings.

How to solve the problem of emulator not running?

1 Only wipe up the data in the emulator and the run the emulator again. This thing solve my problem. – Syed Rafaqat Hussain Sep 17 2021 at 10:19 Add a comment |

Why is my Android Studio crashing on my Emulator?

ProTip: Clearing you Android Studio cache could clear huge chunks of data! If your emulator is a device with the Google Play Services enabled, the error might be related to “OpenGL” to fix this, simply: Change “Graphics” to “Software”.


1 Answers

I managed to fix this issue by adding a line google() to ~/my-app/android/build.gradle in the following section:

allprojects {
    respositories{
        google() //right here
    }
}

Just a guess, but I believe it is a regression to do with the new Android Studio 3.2.0 release.

like image 181
Socceroos Avatar answered Sep 29 '22 20:09

Socceroos