Restoring Android Studio 3 AVD Manager

From PiRho Knowledgebase
Jump to navigationJump to search

Restoring Android Studio 3.0 Android Virtual Device Manager Functionality

Summary: Android Studio 3.0 was designed around a 2017-era Android SDK. Attempting to use Android Studio 3.0 with modern SDK components can result in missing AVD Manager functionality, Gradle synchronisation failures, emulator incompatibilities, and a generally unstable development environment. This article documents the investigation, diagnosis, reconstruction, and validation of a fully functional Android Studio 3.0 environment capable of running Android 8.0 Oreo (API 26) virtual devices.
== Symptoms ==
The environment initially exhibited the following symptoms: * Android Virtual Device (AVD) Manager missing or unavailable. * Android-specific tooling partially disabled. * Emulator installed but not fully integrated into Android Studio. * Gradle project synchronisation failures. * Dependency resolution failures. * Modern SDK components installed alongside Android Studio 3.0. Example errors included: <syntaxhighlight lang="text"> Could not resolve junit:junit:4.12 Could not resolve javax.inject:javax.inject:1 Could not resolve org.hamcrest:hamcrest-library:1.3 Could not resolve com.squareup:javawriter:2.1.1 </syntaxhighlight>
== Environment ==
=== IDE ===
 Android Studio 3.0.0 Build 171.4408382 
=== Operating System ===
 Windows 10 
=== SDK Location ===
 S:\Android\Sdk 
== Initial Observations ==

Although Android Studio appeared to function, the installed Android SDK contained components from wildly different generations. The SDK contained:

 Build Tools 37.0.0 Build Tools 36.x Android Emulator 37.1.11 Android API 36 Command Line Tools (latest) 

alongside:

 Android Studio 3.0 Android API 26 Build Tools 26.0.2 

This created a compatibility mismatch between the IDE and the SDK.

== Investigation Process ==
=== Verify Emulator Installation ===

The first step was to determine whether the Android Emulator itself was operational. <syntaxhighlight lang="dos"> S:\Android\Sdk\emulator\emulator.exe -version </syntaxhighlight> Output:

 Android emulator version 37.1.11.0 

The emulator was present and functioning. The problem therefore was not a missing emulator.

=== Verify SDK Tools ===
The next step was to verify installation of the classic Android SDK tooling. <syntaxhighlight lang="dos"> S:\Android\Sdk\tools\bin\avdmanager.bat list target </syntaxhighlight> Initially this failed because Java was not available through the operating system environment.
=== Verify Java ===

Android Studio ships with a bundled Java Runtime Environment. <syntaxhighlight lang="dos"> "S:\Program Files\Android\Android Studio\jre\bin\java.exe" -version </syntaxhighlight> Output:

 openjdk version "1.8.0_152-release" 

Environment variables were then configured: <syntaxhighlight lang="dos"> set JAVA_HOME=S:\Program Files\Android\Android Studio\jre set PATH=%JAVA_HOME%\bin;%PATH% </syntaxhighlight> Once Java was available, SDK tooling began functioning correctly.

== Root Cause ==

The underlying issue was a version mismatch. Android Studio 3.0 expects components contemporary with its release period:

 2017 

The SDK, however, had accumulated components from approximately:

 2017 - 2026 

Android Studio 3.0 can become unstable when paired with modern Android SDK components, particularly: * Modern Emulator releases. * Modern Build Tools. * Modern Platform Tools. * Modern Command Line Tools.

== Reconstructing a Period-Correct SDK ==
=== Android Studio ===
 Android Studio 3.0.0 
=== Java ===
 OpenJDK 1.8.0_152 
=== SDK Tools ===

pre> 26.1.1 Validation: <syntaxhighlight lang="dos"> sdkmanager.bat --version </syntaxhighlight> Output:

 26.1.1 
=== Platform Tools ===
 26.0.0 

Direct download:

 https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip 

Validation: <syntaxhighlight lang="dos"> adb version </syntaxhighlight> Output:

 Android Debug Bridge version 1.0.39 
=== Build Tools ===
 26.0.2 

Validation: <syntaxhighlight lang="dos"> dir S:\Android\Sdk\build-tools </syntaxhighlight> Output:

 26.0.2 
=== Android Platform ===
 Android 8.0 (API 26) 

Validation: <syntaxhighlight lang="dos"> avdmanager.bat list target </syntaxhighlight> Output:

 Android API 26 
=== Emulator ===

The originally installed emulator was:

 37.1.11.0 

A period-correct emulator was installed instead. Recommended:

 Android Emulator 27.2.9.0 Build ID 4773671 
=== HAXM ===
 Intel HAXM 7.8.0 

Validation: <syntaxhighlight lang="dos"> emulator-check.exe accel </syntaxhighlight> Output:

 HAXM version 7.8.0 (4) is installed and usable. 
== Verifying SDK Functionality ==
=== List Targets ===

<syntaxhighlight lang="dos"> avdmanager.bat list target </syntaxhighlight> Expected:

 Android API 26 
=== List Devices ===

<syntaxhighlight lang="dos"> avdmanager.bat list device </syntaxhighlight> Expected:

 Pixel Pixel XL Nexus 5 Nexus 5X Nexus 6P ... 
=== Verify Installed System Images ===

Installed images included:

 android-26/default/x86 android-26/default/x86_64 android-26/google_apis_playstore/x86 
== Creating a Test Device ==

A command-line AVD was created. <syntaxhighlight lang="dos"> avdmanager create avd ^ -n Test26 ^ -k "system-images;android-26;default;x86" </syntaxhighlight> Verification: <syntaxhighlight lang="dos"> avdmanager list avd </syntaxhighlight> Output:

 Name: Test26 Target: Android 8.0 Oreo ABI: x86 
== Launching the Emulator ==

<syntaxhighlight lang="dos"> emulator.exe -avd Test26 </syntaxhighlight> Output:

 HAX is working and emulator runs in fast virt mode. 

The emulator booted successfully.

== Verifying ADB Connectivity ==

<syntaxhighlight lang="dos"> adb devices </syntaxhighlight> Output:

 List of devices attached emulator-5554 device 

This confirms: * Emulator operational. * Android boot completed. * ADB communications operational. * Development tooling working correctly.

== Restoring AVD Manager ==
After rebuilding the SDK using period-correct components and configuring Java correctly, Android Studio regained full AVD functionality. The following items became available: * Android Virtual Device Manager. * Pixel device profiles. * Oreo API 26 system images. * AVD creation wizard. * Emulator launch integration. A new Pixel API 26 virtual device was successfully created through the Android Studio graphical interface.
== Final Working Configuration ==
 Android Studio 3.0.0 Java 1.8.0_152 SDK Tools 26.1.1 Platform Tools 26.0.0 Build Tools 26.0.2 Platform Android API 26 System Images Oreo x86 / x86_64 Emulator 27.2.9.0 HAXM 7.8.0 
== Lessons Learned ==
=== Validate Components Individually ===
A functioning emulator does not prove Android Studio integration is working. Test the following independently: * Java * SDK Tools * Platform Tools * Emulator * HAXM * ADB
=== Avoid Mixing SDK Generations ===

The Android SDK evolves rapidly. Combining:

 Android Studio 3.0 

with:

 Emulator 37.x Build Tools 37.x Platform Tools 37.x 

creates compatibility issues.

=== Keep Legacy SDKs Isolated ===
Maintain separate SDK trees for: * Legacy Android Studio versions. * Modern Android Studio versions. This prevents accidental upgrades.
=== Archive Known-Good Components ===
Google's historical packages can be difficult to locate years later. Maintaining an archive of known-good versions simplifies future environment rebuilds.
== Related Topics ==
* Android Studio Legacy Environment Preservation * Android SDK Version Compatibility * Intel HAXM Configuration * Android Emulator Troubleshooting * Gradle Dependency Resolution * Software Archaeology * Development Environment Reconstruction
== Conclusion ==
The Android Virtual Device Manager issue was ultimately resolved by reconstructing a period-correct Android Studio 3.0 SDK environment, aligning Java, SDK Tools, Platform Tools, Build Tools, Emulator, and HAXM versions to the same era. Once the toolchain was made historically consistent, Android Studio successfully restored full AVD functionality and was able to create and run a Pixel Oreo (API 26) emulator. The remaining issues, relating to Gradle dependency resolution, became isolated and significantly easier to troubleshoot once the underlying SDK compatibility issues had been eliminated.

Additional Findings

Following restoration of Android Virtual Device Manager, additional compatibility issues were identified and resolved.

These issues were not directly related to AVD Manager but were preventing successful project compilation and deployment.

Gradle Repository Compatibility

Gradle synchronisation initially failed with dependency resolution errors.

Example:

<syntaxhighlight lang="text"> Could not resolve junit:junit:4.12

PKIX path building failed

unable to find valid certification path to requested target </syntaxhighlight>

Cause

Android Studio 3.0 uses an older Java Runtime Environment:

OpenJDK 1.8.0_152

The project was attempting to retrieve dependencies from:

https://jcenter.bintray.com

JCenter has long since been discontinued and certificate validation failed.

Resolution

Repositories were updated to use:

<syntaxhighlight lang="gradle"> google() mavenCentral() </syntaxhighlight>

instead of:

<syntaxhighlight lang="gradle"> jcenter() </syntaxhighlight>

Gradle synchronisation then completed successfully.

ConstraintLayout Version Compatibility

The project initially referenced:

<syntaxhighlight lang="gradle"> implementation 'com.android.support.constraint:constraint-layout:2.0.4' </syntaxhighlight>

Compilation failed with errors including:

<syntaxhighlight lang="text"> android:attr/dialogCornerRadius not found android:attr/fontVariationSettings not found android:attr/ttcIndex not found </syntaxhighlight>

Cause

ConstraintLayout 2.0.4 belongs to a significantly newer Android tooling generation and introduces dependencies on Android Support Library 28.x components.

The project was targeting:

compileSdkVersion 26
targetSdkVersion 26

Resolution

ConstraintLayout was downgraded to the version contemporary with Android Studio 3.0:

<syntaxhighlight lang="gradle"> implementation 'com.android.support.constraint:constraint-layout:1.0.2' </syntaxhighlight>

Resource compilation errors were eliminated.

Android Test Framework Dependency Conflict

After resolving ConstraintLayout issues, Gradle reported:

<syntaxhighlight lang="text"> Conflict with dependency com.android.support:support-annotations

Resolved versions for app (26.1.0) and test app (27.1.1) differ </syntaxhighlight>

Cause

Android Test Runner and Espresso were introducing a newer version of:

support-annotations

than the rest of the Android Support Libraries.

Resolution

Explicit dependency version alignment was introduced:

<syntaxhighlight lang="gradle"> androidTestImplementation(

   'com.android.support.test:runner:1.0.2'

) {

   exclude group: 'com.android.support',
           module: 'support-annotations'

}

androidTestImplementation(

   'com.android.support.test.espresso:espresso-core:3.0.2'

) {

   exclude group: 'com.android.support',
           module: 'support-annotations'

}

implementation

   'com.android.support:support-annotations:26.1.0'

</syntaxhighlight>

All Android Support Library components were then aligned to version 26.1.0.

Final Validation

The rebuilt environment was validated by:

  • Creating a Pixel virtual device.
  • Installing Android 8.0 Oreo (API 26).
  • Building a Kotlin Android application.
  • Deploying to the emulator.
  • Confirming successful execution.

The standard Android Studio sample application launched successfully and displayed:

Hello World!

Final Working Environment

Android Studio      3.0.0
Java                1.8.0_152
Gradle              4.1
SDK Tools           26.1.1
Platform Tools      26.0.0
Build Tools         26.0.2
Platform            Android API 26
ConstraintLayout    1.0.2
AppCompat           26.1.0
Emulator            27.2.9.0
HAXM                7.8.0
Pixel Emulator      Oreo (API 26)

Outcome

The environment was restored to a fully operational Android Studio 3.0 development platform.

The following workflow was successfully validated:

Edit
 → Build
 → Deploy
 → Emulator Launch
 → Application Execution

The resulting environment closely matches a historically accurate Android development workstation from the Android Studio 3.0 / Android 8.0 Oreo era.