Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx_flutter_message
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx_flutter_message
Commits
7d147882
提交
7d147882
authored
10月 30, 2025
作者:
史晓晨
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:适配Flutter SDK 3.24.5,升级AGP 8.0+
上级
d665d252
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
31 行增加
和
70 行删除
+31
-70
build.gradle
android/build.gradle
+10
-26
AndroidManifest.xml
android/src/main/AndroidManifest.xml
+1
-3
ClxFlutterMessagePluginTest.kt
...om/clx/clx_flutter_message/ClxFlutterMessagePluginTest.kt
+0
-27
build.gradle
example/android/app/build.gradle
+10
-6
build.gradle
example/android/build.gradle
+2
-2
gradle-wrapper.properties
example/android/gradle/wrapper/gradle-wrapper.properties
+1
-1
pubspec.yaml
pubspec.yaml
+7
-5
没有找到文件。
android/build.gradle
浏览文件 @
7d147882
...
...
@@ -2,14 +2,14 @@ group 'com.clx.clx_flutter_message'
version
'1.0-SNAPSHOT'
buildscript
{
ext
.
kotlin_version
=
'1.
7.1
0'
ext
.
kotlin_version
=
'1.
8.2
0'
repositories
{
google
()
mavenCentral
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:
7.3.0
'
classpath
'com.android.tools.build:gradle:
8.1.1
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
...
...
@@ -25,19 +25,20 @@ apply plugin: 'com.android.library'
apply
plugin:
'kotlin-android'
android
{
if
(
project
.
android
.
hasProperty
(
"namespace"
))
{
namespace
'com.clx.clx_flutter_message'
}
compileSdkVersion
33
// 1. 升级 compileSdk 至 36(AGP 8.13 最佳兼容版本,替代 compileSdkVersion)
compileSdk
34
// 2. JDK 版本需升级至 17(AGP 8.13 强制要求)
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1
_8
targetCompatibility
JavaVersion
.
VERSION_1
_8
sourceCompatibility
JavaVersion
.
VERSION_1
7
targetCompatibility
JavaVersion
.
VERSION_1
7
}
// 3. Kotlin JVM 目标版本同步为 17
kotlinOptions
{
jvmTarget
=
'1
.8
'
jvmTarget
=
'1
7
'
}
sourceSets
{
...
...
@@ -46,23 +47,6 @@ android {
}
defaultConfig
{
minSdkVersion
19
}
dependencies
{
testImplementation
'org.jetbrains.kotlin:kotlin-test'
testImplementation
'org.mockito:mockito-core:5.0.0'
}
testOptions
{
unitTests
.
all
{
useJUnitPlatform
()
testLogging
{
events
"passed"
,
"skipped"
,
"failed"
,
"standardOut"
,
"standardError"
outputs
.
upToDateWhen
{
false
}
showStandardStreams
=
true
}
}
minSdkVersion
21
}
}
android/src/main/AndroidManifest.xml
浏览文件 @
7d147882
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.clx.clx_flutter_message"
>
</manifest>
<manifest
/>
android/src/test/kotlin/com/clx/clx_flutter_message/ClxFlutterMessagePluginTest.kt
deleted
100644 → 0
浏览文件 @
d665d252
package
com.clx.clx_flutter_message
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
import
kotlin.test.Test
import
org.mockito.Mockito
/*
* This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation.
*
* Once you have built the plugin's example app, you can run these tests from the command
* line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or
* you can run them directly from IDEs that support JUnit such as Android Studio.
*/
internal
class
ClxFlutterMessagePluginTest
{
@Test
fun
onMethodCall_getPlatformVersion_returnsExpectedValue
()
{
val
plugin
=
ClxFlutterMessagePlugin
()
val
call
=
MethodCall
(
"getPlatformVersion"
,
null
)
val
mockResult
:
MethodChannel
.
Result
=
Mockito
.
mock
(
MethodChannel
.
Result
::
class
.
java
)
plugin
.
onMethodCall
(
call
,
mockResult
)
Mockito
.
verify
(
mockResult
).
success
(
"Android "
+
android
.
os
.
Build
.
VERSION
.
RELEASE
)
}
}
example/android/app/build.gradle
浏览文件 @
7d147882
...
...
@@ -24,16 +24,20 @@ if (flutterVersionName == null) {
android
{
namespace
"com.clx.clx_flutter_message_example"
compileSdkVersion
flutter
.
compileSdkVersion
ndkVersion
flutter
.
ndkVersion
// 1. 升级 compileSdk 至 36(AGP 8.13 最佳兼容版本,替代 compileSdkVersion)
compileSdk
34
// 2. JDK 版本需升级至 17(AGP 8.13 强制要求)
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1
_8
targetCompatibility
JavaVersion
.
VERSION_1
_8
sourceCompatibility
JavaVersion
.
VERSION_1
7
targetCompatibility
JavaVersion
.
VERSION_1
7
}
// 3. Kotlin JVM 目标版本同步为 17
kotlinOptions
{
jvmTarget
=
'1
.8
'
jvmTarget
=
'1
7
'
}
sourceSets
{
...
...
@@ -45,8 +49,8 @@ android {
applicationId
"com.clx.clx_flutter_message_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion
flutter
.
minSdkVersion
targetSdkVersion
flutter
.
targetSdkVersion
minSdkVersion
21
// 支持最低版本可保留 21(AGP 8.13 兼容)
targetSdkVersion
31
// 建议与 compileSdk 一致(原 31 过低,需升级)
versionCode
flutterVersionCode
.
toInteger
()
versionName
flutterVersionName
}
...
...
example/android/build.gradle
浏览文件 @
7d147882
buildscript
{
ext
.
kotlin_version
=
'1.
7.1
0'
ext
.
kotlin_version
=
'1.
8.2
0'
repositories
{
google
()
mavenCentral
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:
7.3.0
'
classpath
'com.android.tools.build:gradle:
8.1.1
'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
...
...
example/android/gradle/wrapper/gradle-wrapper.properties
浏览文件 @
7d147882
...
...
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
7.5
-bin.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
8.1
-bin.zip
pubspec.yaml
浏览文件 @
7d147882
...
...
@@ -13,16 +13,18 @@ dependencies:
flutter_web_plugins
:
sdk
:
flutter
plugin_platform_interface
:
^2.0.2
web_socket_channel
:
^
2.1.0
web_socket_channel
:
^
3.0.3
octo_image
:
^2.0.0
cached_network_image
:
^3.3.0
fluttertoast
:
8.2.4
get
:
^4.6.6
cached_network_image
:
^3.4.1
fluttertoast
:
^8.2.14
get
:
^4.7.2
dio
:
^5.9.0
dev_dependencies
:
flutter_test
:
sdk
:
flutter
flutter_lints
:
^2.0.0
dio
:
^5.7.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论