Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build.gradle for latest AGP #2026

Merged
merged 2 commits into from
Nov 17, 2020
Merged

Update build.gradle for latest AGP #2026

merged 2 commits into from
Nov 17, 2020

Conversation

luncliff
Copy link
Contributor

@luncliff luncliff commented Nov 17, 2020

Changes

Last month(2020/10), there was Android Studio 4.1 release, this PR targets that.

Tool Requirement

Adjust for the IDE (Android Studio)

  • Gradle 5.x -> 6.6.1
  • Android Gradle Plugin 3.x -> 4.1.1
  • Android NDK 21.3.6528147

NDK version is not mandatory. Users can comment the line, and use their own.

Usage

The build step is not changed.

pushd support # this folder has build.gradle
    gradle assemble
popd

tree -L 2 ./libs

Note

ignore .cxx which was externalNativeBuild in old Android Gradle Plugin versions

build.gradle file now uses variable rootDir instead of using the relative path to make ease of understanding.

user:host$ pushd support/
~/dev/fmt/support ~/dev/fmt
user:host$ gradle assemble

> Configure project :
rootDir: /Users/user/dev/fmt
[-std=c++17]
[-DANDROID_STL=c++_shared, -DBUILD_SHARED_LIBS=true, -DFMT_TEST=false, -DFMT_DOC=false]

> Task...

After the install, the libs/ folder will contain .so for each architecture and .aar files

user:host$ tree $(pwd)/../libs
/Users/user/dev/fmt/support/../libs
├── debug
│   ├── arm64-v8a
│   ├── armeabi-v7a
│   └── x86_64
│       ├── libc++_shared.so
│       └── libfmtd.so
├── fmt-debug.aar
├── fmt-release.aar
└── release
    ├── arm64-v8a
    ├── armeabi-v7a
    └── x86_64

With the AGP 4.1, the aar include files in include/fmt/*.h.

user:host$ unzip ./fmt-debug.aar -d .
Archive:  ./fmt-debug.aar
  inflating: ./R.txt                 
  inflating: ./AndroidManifest.xml   
  inflating: ./classes.jar           
   creating: ./jni/
...
  creating: ./prefab/modules/fmt/include/
   creating: ./prefab/modules/fmt/include/fmt/
  inflating: ./prefab/modules/fmt/include/fmt/chrono.h  
  inflating: ./prefab/modules/fmt/include/fmt/color.h  
...
  inflating: ./prefab/modules/fmt/include/fmt/ranges.h  
   creating: ./prefab/modules/fmt/libs/
   creating: ./prefab/modules/fmt/libs/android.arm64-v8a/
  inflating: ./prefab/modules/fmt/libs/android.arm64-v8a/abi.json  
  inflating: ./prefab/modules/fmt/libs/android.arm64-v8a/libfmtd.so  
...

Related Issues

Previous Work

#1039 (update for Gradle 5.2)

License Agreement

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

* bump Android Gradle Plugin version to 4.1.1
* ignore .cxx which was externalNativeBuild in old versions

Use variable 'rootDir' instead of using relative path.
@vitaut vitaut merged commit 6cdd1be into fmtlib:master Nov 17, 2020
@vitaut
Copy link
Contributor

vitaut commented Nov 17, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants