Skip to content

Android

LeoTM edited this page May 9, 2024 · 101 revisions

Android 13 Beta | SDK/API 33 (levels) | Tiramisu | T

SDK

  • Nov 2007 - Android SDK
  • Oct 2008 - Google Play (service)
  • Oct 2010 - Google TV (OS)
  • Mar 2014 - Wear/Watch (OS)
  • Jun 2014 - Android TV (OS)

Source

Gradle

...open-source build automation tool focused on flexibility and performance...

...build scripts are written using a Groovy or Kotlin DSL...

~/.gradle/caches/*

cd android
./gradlew wrapper --gradle-version=7.x --distribution-type=all
gradle <command> -PreactNativeArchitectures=arm64-v8a

AGP

The Android Studio build system is based on Gradle, and the Android Gradle plugin adds several features that are specific to building Android apps

Altho the Android plugin is typically updated in lock-step with Android Studio, the plugin (and the rest of the Gradle system) can run independent of Android Studio and be updated separately

NDK

...a toolset that lets you implement parts of your app in native code, using languages like C and C++

For certain types of apps, this can help you reuse code libraries written in those languages

Emu's

emulator -avd Pixel_3a_API_31_arm64-v8a -wipe-data

Android Studio (IDE)

Badges badges everywhere Screenshot 2022-02-23 at 11 57 46

Logs

/Users/<user>/Library/Logs/Google

Codegen

android/.gradle/
android/.idea/
android/app/build/
android/build/
android/local.properties

Bundles

  • android/app/build/ASSETS/createBundleReleaseJsAndAssets/index.android.bundle
  • android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
  • android/app/build/outputs/bundle/debug/app-debug.aab
  • android/app/build/outputs/bundle/release/app-release.aab

JDK

Any aarch64 JDK v11+ (unofficial, ~x2 faster), official 32-bit slower

java --version # Current
/usr/libexec/java_home -V # JVMs
export JAVA_HOME=`/usr/libexec/java_home -v 11` # Set v11

https://github.com/mdogan/homebrew-zulu#versions

Set JDK for Android Studio Screenshot 2022-04-03 at 16 26 21

Setting up the development environment

Which version of JDK should I use? (whichjdk.com)

Set project custom

# gradle.properties
# ...
# Android Studio (aarch64 or aarch32) e.g.
org.gradle.java.home=/Users/<user>/Library/Java/JavaVirtualMachines/azul-18.0.1/Contents/Home
# Brew e.g.
org.gradle.java.home=/Library/Java/JavaVirtualMachines/zulu-18.jdk/Contents/Home

Switch locally

jenv add <path>

Build Tools

e.g.

ADB

Connect device

adb reverse tcp:8097 tcp:8097

Install apk

adb install <path-to-apk>

Uninstall app

adb uninstall <applicationId>

e.g. io.metamask


πŸ›

Android app:install

Execution failed for task ':app:installDebug'
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_INSUFFICIENT_STORAGE

Wipe/reset (-wipe-data) emu data (user data image copied from initdata)


Execution failed for task ':app:installDebug'
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unknown failure: Exception occurred while executing 'install':
  android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space

Restart emu

Android Studio

Screenshot 2022-02-11 at 17 07 41
!bootstrap.error.message.internal.error.please.refer.to.0!https://code.google.com/p/android/issues!

java.lang.IllegalAccessError: class com.intellij.idea.StartupUtil (in unnamed module @0x11a5a6ea) cannot access class sun.awt.AWTAutoShutdown (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x11a5a6ea
    at com.intellij.idea.StartupUtil.start(StartupUtil.java:301)
    at com.intellij.idea.Main.bootstrap(Main.java:140)
    at com.intellij.idea.Main.main(Main.java:83)

-----
!bootstrap.error.message.jre.details!16.0.1+9 x86_64 (AdoptOpenJDK)
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home!
Internal error. Please refer to https://code.google.com/p/android/issues

com.intellij.ide.plugins.StartupAbortedException: UI initialization failed
    at com.intellij.idea.StartupUtil.lambda$start$15(StartupUtil.java:268)
    at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:986)
    at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:970)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
    at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
    at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:791)
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.util.concurrent.CompletionException: java.lang.IllegalAccessException: symbolic reference class is not accessible: class com.apple.laf.AquaLookAndFeel, from class com.intellij.ide.ui.laf.darcula.DarculaLaf (unnamed module @6ae7f2a3)
    at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$22(StartupUtil.java:464)
    at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:783)
    ... 14 more
Caused by: java.lang.IllegalAccessException: symbolic reference class is not accessible: class com.apple.laf.AquaLookAndFeel, from class com.intellij.ide.ui.laf.darcula.DarculaLaf (unnamed module @6ae7f2a3)
    at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:957)
    at java.base/java.lang.invoke.MethodHandles$Lookup.checkSymbolicClass(MethodHandles.java:3675)
    at java.base/java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:3647)
    at java.base/java.lang.invoke.MethodHandles$Lookup.findConstructor(MethodHandles.java:2757)
    at com.intellij.ide.ui.laf.darcula.DarculaLaf.createBaseLaF(DarculaLaf.java:345)
    at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$22(StartupUtil.java:458)
    ... 15 more

-----
Your JRE: 16.0.1+9 x86_64 (AdoptOpenJDK)
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
Screenshot 2022-02-23 at 11 50 36 Screenshot 2022-02-15 at 11 11 00 Screenshot 2022-02-23 at 11 53 40

Issue here was incompatible JDK

Screenshot 2022-02-23 at 13 07 26

Issue here was corrupted Android SDK, re-install

Emu

Screenshot 2022-02-15 at 10 58 29 Screenshot 2022-02-23 at 11 38 45 Screenshot 2022-02-23 at 11 47 51
Clone this wiki locally