Skip to content

build-toos/aapt2 issue with gradle in android termux #35

@amsitlab

Description

@amsitlab

If we use gradle build tools in termux (android) to build android apps,
android-sdk build-tools/<version>/aapt2 is unused
cause android gradle plugin (AGP) will auto download and use aapt2 from https://maven.google.com/web/m_index.html#com.android.tools.build:aapt2
and that will produce an error in termux
because downloaded file contains executable for linux and not compatible for termux

current solution:

  • use maven local repository in all build.gradle
  • convert all jar file in ~/.gradle/cache/modules-2/files-1/ to maven local repository format by using this script (without finalizedBy)
  • run gradle cacheToMavenLocal
  • replace executable aapt2 in .m2/repository/com/android/tools/build/aapt2/< version >/aapt2-< version >.jar (downloaded by AGP from here ) with aapt2 provided by termux
  • and rebuild gradle assembleDebug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions