Skip to content

Commit bb5563a

Browse files
committed
升级agp8.4.2、ndk27、配置16kb
1 parent b1f3f4e commit bb5563a

File tree

10 files changed

+77
-53
lines changed

10 files changed

+77
-53
lines changed

android/f2native/build.gradle

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'maven'
32
apply plugin: 'maven-publish'
4-
apply plugin: 'com.github.dcendents.android-maven'
53
group='com.github.antvis'
64

75
android {
86

9-
compileSdkVersion rootProject.extensions.sdks.CompileSDK
10-
buildToolsVersion rootProject.extensions.sdks.BuildTool
7+
compileSdk rootProject.extensions.sdks.CompileSDK
8+
ndkVersion rootProject.extensions.sdks.ndkVersion
119

1210
defaultConfig {
11+
namespace "com.antgroup.antv.f2"
1312
minSdkVersion rootProject.extensions.sdks.MinSDK
1413
targetSdkVersion rootProject.extensions.sdks.TargetSDK
1514
versionCode 1
1615
versionName "1.0"
17-
18-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
multiDexEnabled false
1917

2018
externalNativeBuild {
2119
cmake {
22-
cppFlags "-DTARGET_ALIPAY"
23-
cFlags "-ffunction-sections -fdata-sections"
24-
arguments "-DANDROID_STL=c++_shared", '-DTARGET_ALIPAY=1'
20+
cppFlags rootProject.extensions.externalNativeCmake.cppFlags
21+
arguments = []
22+
arguments.addAll(rootProject.extensions.externalNativeCmake.arguments)
2523
}
2624
}
2725
ndk {
@@ -30,22 +28,40 @@ android {
3028
}
3129
}
3230

31+
lintOptions {
32+
checkReleaseBuilds false
33+
abortOnError false
34+
}
35+
3336
buildTypes {
3437
release {
3538
minifyEnabled false
3639
}
3740
}
3841

42+
compileOptions {
43+
targetCompatibility rootProject.extensions.compileOptions.targetCompatibility
44+
sourceCompatibility rootProject.extensions.compileOptions.sourceCompatibility
45+
}
46+
3947
externalNativeBuild {
4048
cmake {
4149
path "../../CMakeLists.txt"
4250
}
4351
}
52+
53+
packagingOptions {
54+
exclude '**/libc++_shared.so'
55+
exclude '**/**/libc++_shared.so'
56+
}
57+
58+
sourceSets {
59+
main.manifest.srcFile 'src/main/AndroidManifest.xml'
60+
main.java.srcDirs = ['src/main/java']
61+
main.res.srcDirs = ['src/main/res']
62+
}
4463
}
4564

4665
dependencies {
47-
implementation fileTree(dir: 'libs', include: ['*.jar'])
48-
testImplementation 'junit:junit:4.+'
49-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
50-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
51-
}
66+
compileOnly rootProject.extensions.dependencies.fastjson
67+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<manifest package="com.antgroup.antv.f2"
1+
<manifest
22
xmlns:android="http://schemas.android.com/apk/res/android"/>

android/f2native/src/main/java/com/antgroup/antv/f2/F2AndroidCanvasContext.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* android native canvas需要的CanvasContext
2020
*/
21-
public class F2AndroidCanvasContext {
21+
public class F2AndroidCanvasContext {
2222
public Bitmap bitmap = null;
2323
private Canvas bitmapCanvas = null;
2424
private Paint paint = null;
@@ -49,9 +49,7 @@ public class F2AndroidCanvasContext {
4949
}
5050

5151
private void innerLog(String content) {
52-
if (BuildConfig.DEBUG) {
53-
F2Log.i("F2AndroidCanvasContext", content);
54-
}
52+
// F2Log.i("F2AndroidCanvasContext", content);
5553
}
5654

5755
//set

build.gradle

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
4-
ext.kotlin_version = "1.4.31"
2+
ext.kotlin_version = '2.0.0'
53
repositories {
64
google()
75
jcenter()
86

97
}
108
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.5.3'
12-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
9+
classpath 'com.android.tools.build:gradle:8.4.2'
1310
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1411
}
1512
}
@@ -27,14 +24,25 @@ task clean(type: Delete) {
2724
delete rootProject.buildDir
2825
}
2926

27+
3028
rootProject.extensions.sdks = [
31-
'Gradle' : '3.0.1',
32-
'CompileSDK' : 28,
33-
'BuildTool' : '28.0.3',
34-
'MinSDK' : 18,
35-
'TargetSDK' : 28,
36-
'JUnit' : '4.12',
37-
'Support' : '26.0.2',
38-
'ABIs' : ["armeabi-v7a","arm64-v8a"],
39-
'EXCLUDE_CPP_SHARED' : false
29+
'CompileSDK': 34,
30+
'MinSDK' : 21,
31+
'TargetSDK' : 34,
32+
'ABIs' : ["armeabi-v7a", "arm64-v8a"],
33+
'ndkVersion': "27.2.12479018"
34+
]
35+
36+
rootProject.extensions.dependencies = [
37+
'fastjson': 'com.alibaba:fastjson:1.2.73',
4038
]
39+
40+
rootProject.extensions.externalNativeCmake = [
41+
'cppFlags' : "-ffunction-sections -fdata-sections",
42+
'arguments': ["-DANDROID_STL=c++_static"]
43+
]
44+
45+
rootProject.extensions.compileOptions = [
46+
'targetCompatibility': 11,
47+
'sourceCompatibility': 11
48+
]

demos/android/demos-kotlin/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ plugins {
44
}
55

66
android {
7-
compileSdkVersion rootProject.extensions.sdks.CompileSDK
8-
buildToolsVersion rootProject.extensions.sdks.BuildTool
7+
compileSdk rootProject.extensions.sdks.CompileSDK
8+
ndkVersion rootProject.extensions.sdks.ndkVersion
99
defaultConfig {
10-
applicationId "com.antgroup.antv.f2.kotlinsamples"
10+
namespace "com.antgroup.antv.f2.kotlinsamples"
1111
minSdkVersion rootProject.extensions.sdks.MinSDK
1212
targetSdkVersion rootProject.extensions.sdks.TargetSDK
1313
versionCode 1
1414
versionName "1.0"
15+
multiDexEnabled false
1516
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1617
}
1718
buildTypes {

demos/android/demos/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion rootProject.extensions.sdks.CompileSDK
5-
buildToolsVersion rootProject.extensions.sdks.BuildTool
4+
compileSdk rootProject.extensions.sdks.CompileSDK
65
defaultConfig {
7-
applicationId "com.antgroup.antv.f2.samples"
6+
namespace "com.antgroup.antv.f2.samples"
87
minSdkVersion rootProject.extensions.sdks.MinSDK
98
targetSdkVersion rootProject.extensions.sdks.TargetSDK
109
versionCode 1
@@ -28,7 +27,6 @@ dependencies {
2827
implementation "androidx.recyclerview:recyclerview:1.1.0"
2928
implementation "androidx.appcompat:appcompat:1.2.0"
3029

31-
// implementation 'com.github.antvis:F2Native:2.0.8'
3230
implementation project(':android:f2native')
3331
implementation 'com.alibaba:fastjson:1.2.73'
3432

demos/android/demos/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
android:label="@string/title_activity_bridge"
2727
android:theme="@style/AppTheme" />
2828

29-
<activity android:name="com.antgroup.antv.f2.samples.MainActivity">
29+
<activity android:name="com.antgroup.antv.f2.samples.MainActivity"
30+
android:exported="true">
31+
3032
<intent-filter>
3133
<action android:name="android.intent.action.MAIN" />
3234

demos/android/demos/src/main/java/com/antgroup/antv/f2/samples/MainActivity.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,19 @@ public boolean onCreateOptionsMenu(Menu menu) {
6363

6464
@Override
6565
public boolean onOptionsItemSelected(MenuItem item) {
66-
switch (item.getItemId()) {
67-
case R.id.action_multiCharts: {
68-
Intent intent = new Intent(this, ChartListActivity.class);
69-
startActivity(intent);
70-
break;
71-
}
72-
case R.id.action_bridge:{
73-
startActivity(new Intent(this,BridgeActivity.class));
74-
break;
75-
}
66+
if (item.getItemId() == R.id.action_multiCharts) {
67+
Intent intent = new Intent(this, ChartListActivity.class);
68+
startActivity(intent);
69+
} else if (item.getItemId() == R.id.action_bridge) {
70+
startActivity(new Intent(this, BridgeActivity.class));
7671
}
7772
return super.onOptionsItemSelected(item);
7873
}
7974

8075
static class ChartViewHolder extends RecyclerView.ViewHolder {
8176

8277
TextView chartName;
78+
8379
public ChartViewHolder(@NonNull View itemView) {
8480
super(itemView);
8581
chartName = itemView.findViewById(R.id.chart_name);
@@ -88,6 +84,7 @@ public ChartViewHolder(@NonNull View itemView) {
8884

8985
static class ChartAdapter extends RecyclerView.Adapter<ChartViewHolder> {
9086
private List<ChartModel> mChartModels;
87+
9188
ChartAdapter(List<ChartModel> chartModels) {
9289
mChartModels = chartModels;
9390
}

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
android.useAndroidX=true
2+
android.injected.testOnly=false
3+
alipay.useJDK17=true
4+
org.gradle.jvmargs=-Xms8G -Xmx12G
5+
android.zipAlignPageSize=16384
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Wed Jan 27 10:21:44 CST 2021
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

0 commit comments

Comments
 (0)