Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio IDE emulator opens, but project is not running/Compling

When I compiled my Android Studio IDE project, the emulator had opened, but project didn't run.I am using the latest version of Android IDE and I uninstalled Android IDE couple of times, and then again reinstalled it. Still, the problem persists.

Please help me fixing this problem.

When I run my Android Studio IDE project, I got this message at Build window:

Could not find com.android.tools.build:aapt2:3.3.1-5013011.
Searched in the following locations:
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
  - file:/C:/Users/zunayeed/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
  - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
  - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
Required by:
    project :app
like image 596
Zunayeed Kamal Avatar asked Feb 12 '19 00:02

Zunayeed Kamal


People also ask

How to run Android Studio projects on Android emulator?

While the emulator is running, you can run Android Studio projects and choose the emulator as the target device. You can also drag one or more APKs onto the emulator to install them, and then run them. The Android Emulator runs directly inside Android Studio by default.

How do I run an Android emulator without running the app?

Launch the Android Emulator without first running an app. To start the emulator: Open the AVD Manager. Double-click an AVD, or click Run. The Android Emulator loads. While the emulator is running, you can run Android Studio projects and choose the emulator as the target device.

Why Android Studio screen will show this error despite Android emulator running?

Then android studio screen will show this error despite android emulator is running This error sometimes occurs when the emulator is not closed properly. So, we will fix the android emulator this method is only for Linux user.

Why can't I run a virtual device in Android Studio?

In addition, certain virtual devices—such as Android TV and foldable devices—can't be run in Android Studio because they have specialized UI requirements or important functions in the extended controls. To install an APK file on the emulated device, drag an APK file onto the emulator screen.


1 Answers

I think you missed google repository on your gradle file. To use AAPT2, make sure that you have a google() dependency in your build.gradle file, as shown here:

buildscript {
    repositories {
    google() // here
    jcenter()
}
dependencies {
   classpath 'com.android.tools.build:gradle:3.2.0-alpha12'

  }
} 
allprojects {
  repositories {
  google() // and here
  jcenter()
 }

Source: https://developer.android.com/studio/releases/#aapt2_gmaven

like image 162
Farid Haq Avatar answered Sep 21 '22 20:09

Farid Haq