Skip to content

Commit 5ce4d41

Browse files
committed
Support for API level 31. Update AGP, NDK version.
1 parent a8ef386 commit 5ce4d41

File tree

8 files changed

+63
-47
lines changed

8 files changed

+63
-47
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)
44
![](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)
55
![](https://img.shields.io/badge/release-1.1.1-red.svg?style=flat)
6-
![](https://img.shields.io/badge/Android-4.1%20--%2011-blue.svg?style=flat)
6+
![](https://img.shields.io/badge/Android-4.1%20--%2012-blue.svg?style=flat)
77
![](https://img.shields.io/badge/arch-armeabi--v7a%20%7C%20arm64--v8a%20%7C%20x86%20%7C%20x86__64-blue.svg?style=flat)
88

99
xDL is an enhanced implementation of the Android DL series functions.
@@ -22,7 +22,7 @@ xDL is an enhanced implementation of the Android DL series functions.
2222
* Including linker / linker64 (for Android <= 8.x).
2323
* Return full pathname instead of basename (for Android 5.x).
2424
* Return app\_process32 / app\_process64 instead of package name.
25-
* Support Android 4.1 - 11 (API level 16 - 30).
25+
* Support Android 4.1 - 12 (API level 16 - 31).
2626
* Support armeabi-v7a, arm64-v8a, x86 and x86_64.
2727
* MIT licensed.
2828

@@ -33,10 +33,10 @@ If xDL is compiled into an independent dynamic library:
3333

3434
| ABI | Compressed (KB) | Uncompressed (KB) |
3535
| :---------- | --------------: | ----------------: |
36-
| armeabi-v7a | 6.8 | 13.9 |
37-
| arm64-v8a | 7.5 | 18.3 |
38-
| x86 | 7.7 | 17.9 |
39-
| x86_64 | 7.9 | 18.6 |
36+
| armeabi-v7a | 6.8 | 12.0 |
37+
| arm64-v8a | 7.6 | 16.2 |
38+
| x86 | 7.8 | 15.1 |
39+
| x86_64 | 7.8 | 16.6 |
4040

4141

4242
## Usage

README.zh-CN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)
44
![](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)
55
![](https://img.shields.io/badge/release-1.1.1-red.svg?style=flat)
6-
![](https://img.shields.io/badge/Android-4.1%20--%2011-blue.svg?style=flat)
6+
![](https://img.shields.io/badge/Android-4.1%20--%2012-blue.svg?style=flat)
77
![](https://img.shields.io/badge/arch-armeabi--v7a%20%7C%20arm64--v8a%20%7C%20x86%20%7C%20x86__64-blue.svg?style=flat)
88

99
xDL 是 Android DL 系列函数的增强实现。
@@ -22,7 +22,7 @@ xDL 是 Android DL 系列函数的增强实现。
2222
* 在 Android <= 8.x 时,包含 linker / linker64。
2323
* 在 Android 5.x 中,返回完整的路径名(full pathname),而不是文件名(basename)。
2424
* 返回 app\_process32 / app\_process64,而不是包名。
25-
* 支持 Android 4.1 - 11 (API level 16 - 30)。
25+
* 支持 Android 4.1 - 12 (API level 16 - 31)。
2626
* 支持 armeabi-v7a, arm64-v8a, x86 和 x86_64。
2727
* 使用 MIT 许可证授权。
2828

@@ -33,10 +33,10 @@ xDL 是 Android DL 系列函数的增强实现。
3333

3434
| ABI | 压缩后 (KB) | 未压缩 (KB) |
3535
| :---------- | ---------: | ---------: |
36-
| armeabi-v7a | 6.8 | 13.9 |
37-
| arm64-v8a | 7.5 | 18.3 |
38-
| x86 | 7.7 | 17.9 |
39-
| x86_64 | 7.9 | 18.6 |
36+
| armeabi-v7a | 6.8 | 12.0 |
37+
| arm64-v8a | 7.6 | 16.2 |
38+
| x86 | 7.8 | 15.1 |
39+
| x86_64 | 7.8 | 16.6 |
4040

4141

4242
## 使用

build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:4.2.1'
7+
classpath 'com.android.tools.build:gradle:7.0.0'
88
}
99
}
1010

@@ -22,14 +22,15 @@ task clean(type: Delete) {
2222

2323
ext {
2424
minSdkVersion = 16
25-
compileSdkVersion = 30
26-
targetSdkVersion = 30
27-
buildToolsVersion = "30.0.3"
25+
compileSdkVersion = 31
26+
targetSdkVersion = 31
27+
buildToolsVersion = "31.0.0"
2828
javaVersion = JavaVersion.VERSION_1_7
29-
ndkVersion = "21.4.7075529"
29+
ndkVersion = "22.1.7171670"
3030
cmakeVersion = "3.18.1"
3131
abiFilters = "armeabi-v7a,arm64-v8a,x86,x86_64"
3232
useASAN = false
33+
dependencyOnLocalLibrary = true
3334

3435
POM_GROUP_ID = "io.hexhacking"
3536
POM_ARTIFACT_ID = "xdl"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

xdl/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
apply plugin: 'com.android.library'
1+
plugins {
2+
id 'com.android.library'
3+
}
24

35
android {
46
compileSdkVersion rootProject.ext.compileSdkVersion

xdl_sample/build.gradle

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
apply plugin: 'com.android.application'
1+
plugins {
2+
id 'com.android.application'
3+
}
24

35
android {
46
compileSdkVersion rootProject.ext.compileSdkVersion
@@ -13,6 +15,14 @@ android {
1315
ndk {
1416
abiFilters rootProject.ext.abiFilters.split(",")
1517
}
18+
externalNativeBuild {
19+
cmake {
20+
abiFilters rootProject.ext.abiFilters.split(",")
21+
if (rootProject.ext.dependencyOnLocalLibrary) {
22+
arguments "-DDEPENDENCY_ON_LOCAL_LIBRARY=ON"
23+
}
24+
}
25+
}
1626
}
1727
externalNativeBuild {
1828
cmake {
@@ -35,31 +45,28 @@ android {
3545
minifyEnabled false
3646
}
3747
}
38-
buildFeatures {
39-
prefab true
48+
if (!rootProject.ext.dependencyOnLocalLibrary) {
49+
buildFeatures {
50+
prefab true
51+
}
4052
}
4153
packagingOptions {
4254
pickFirst '**/libxdl.so'
4355
}
56+
lintOptions {
57+
abortOnError false
58+
}
4459
}
4560

4661
dependencies {
47-
implementation 'androidx.appcompat:appcompat:1.3.0'
48-
implementation 'com.google.android.material:material:1.3.0'
62+
implementation 'androidx.appcompat:appcompat:1.3.1'
63+
implementation 'com.google.android.material:material:1.4.0'
4964
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
5065

51-
implementation project(':xdl')
52-
// implementation 'io.hexhacking:xdl:1.1.1'
53-
}
54-
55-
// Bypass the compatibility issue between prefab and gradle-project-dependencies.
56-
// Note: This is not required for gradle-maven-dependencies.
57-
tasks.whenTaskAdded { task ->
58-
if (task.name == 'generateJsonModelDebug') {
59-
task.dependsOn(':xdl:prefabDebugPackage')
60-
}
61-
else if (task.name == 'generateJsonModelRelease') {
62-
task.dependsOn(':xdl:prefabReleasePackage')
66+
if (rootProject.ext.dependencyOnLocalLibrary) {
67+
implementation project(':xdl')
68+
} else {
69+
implementation 'io.hexhacking:xdl:1.1.1'
6370
}
6471
}
6572

xdl_sample/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:supportsRtl="true"
1212
android:theme="@style/AppTheme">
13-
<activity android:name=".MainActivity">
13+
<activity android:name=".MainActivity"
14+
android:exported="true">
1415
<intent-filter>
1516
<action android:name="android.intent.action.MAIN" />
1617

xdl_sample/src/main/cpp/CMakeLists.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
cmake_minimum_required(VERSION 3.18.1)
22
project(sample)
33

4-
# import xdl from local-project
5-
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_DIRNAME)
6-
set(XDL_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../../../xdl)
7-
add_library(xdl::xdl SHARED IMPORTED)
8-
set_target_properties(xdl::xdl PROPERTIES
9-
IMPORTED_LOCATION ${XDL_BASE}/build/intermediates/stripped_native_libs/${BUILD_TYPE_DIRNAME}/out/lib/${ANDROID_ABI}/libxdl.so
10-
INTERFACE_INCLUDE_DIRECTORIES ${XDL_BASE}/src/main/cpp/include)
11-
12-
# import xdl from maven
13-
#find_package(xdl REQUIRED CONFIG)
4+
if(DEPENDENCY_ON_LOCAL_LIBRARY)
5+
# import xdl from local-project
6+
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_DIRNAME)
7+
if(${BUILD_TYPE_DIRNAME} STREQUAL "relwithdebinfo")
8+
set(BUILD_TYPE_DIRNAME "release")
9+
endif()
10+
set(XDL_BASE ${CMAKE_CURRENT_SOURCE_DIR}/../../../../xdl)
11+
add_library(xdl::xdl SHARED IMPORTED)
12+
set_target_properties(xdl::xdl PROPERTIES
13+
IMPORTED_LOCATION ${XDL_BASE}/build/intermediates/stripped_native_libs/${BUILD_TYPE_DIRNAME}/out/lib/${ANDROID_ABI}/libxdl.so
14+
INTERFACE_INCLUDE_DIRECTORIES ${XDL_BASE}/src/main/cpp/include)
15+
else()
16+
# import xdl from maven
17+
find_package(xdl REQUIRED CONFIG)
18+
endif()
1419

1520
add_library(sample SHARED sample.c)
1621
target_compile_features(sample PUBLIC c_std_11)

0 commit comments

Comments
 (0)