fix Android提示旧版本Android系统不兼容问题

fix Android提示旧版本Android系统不兼容问题
This commit is contained in:
zeus
2025-12-24 12:05:57 +08:00
parent 6dd209cbe5
commit d26dab7be1
13 changed files with 46 additions and 87 deletions
@@ -1,72 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.litevpn.fast",
"variantName": "metaRelease",
"elements": [
{
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 321001,
"versionName": "3.0.2",
"outputFile": "UUVPN-3.0.2-meta-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 321001,
"versionName": "3.0.2",
"outputFile": "UUVPN-3.0.2-meta-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86"
}
],
"attributes": [],
"versionCode": 321001,
"versionName": "3.0.2",
"outputFile": "UUVPN-3.0.2-meta-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 321001,
"versionName": "3.0.2",
"outputFile": "UUVPN-3.0.2-meta-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 321001,
"versionName": "3.0.2",
"outputFile": "UUVPN-3.0.2-meta-arm64-v8a-release.apk"
}
],
"elementType": "File"
}
@@ -53,6 +53,7 @@ class LoginActivity : AppCompatActivity() {
private var isPasswordVisible = false
private var configRetryCount = 0
override fun onCreate(savedInstanceState: Bundle?) {
@@ -129,7 +130,9 @@ class LoginActivity : AppCompatActivity() {
private fun getconfig(){
runOnUiThread {
LoadingDialog.show(this, "正在初始化...")
}
CoroutineScope(Dispatchers.IO).launch {
safeApiCall {apiService.getConfig()}.let {
@@ -142,7 +145,15 @@ class LoginActivity : AppCompatActivity() {
//重新初始化 ApiClint
}
}else{
configRetryCount++
if (configRetryCount < 3) {
getconfig()
} else {
withContext(Dispatchers.Main) {
LoadingDialog.hide()
Toast.makeText(this@LoginActivity, "初始化失败,请检查配置是否正确", Toast.LENGTH_LONG).show()
}
}
}
}
}
+3 -3
View File
@@ -42,7 +42,7 @@ subprojects {
minSdk = 24
compileSdkVersion(34)
// targetSdkVersion(34)
targetSdkVersion(34)
versionName = "3.1.0"
versionCode = 323001
@@ -140,8 +140,8 @@ subprojects {
buildTypes {
named("release") {
isMinifyEnabled = isApp
isShrinkResources = isApp
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.findByName("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
@@ -77,3 +77,5 @@ link_directories("${GO_OUTPUT_BASE}/${CMAKE_ANDROID_ARCH_ABI}")
add_library(bridge SHARED main.c jni_helper.c bridge_helper.c)
target_link_libraries(bridge log clash)
# Ensure 16 KB page alignment for Android 15+ compatibility
target_link_options(bridge PRIVATE "-Wl,-z,max-page-size=16384")
@@ -18,8 +18,18 @@ object ApiClient {
.build()
// Lazy initialization of configURL
private val configURL: String by lazy {
PreferenceManager.baseURL
private val configURL: String
get() {
val url = PreferenceManager.baseURL
return if (url.isNullOrEmpty()) {
"https://vungles.com/" // Default fallback URL to prevent crash
} else {
if (!url.startsWith("http://") && !url.startsWith("https://")) {
"https://$url"
} else {
url
}
}
}
@@ -35,6 +45,8 @@ object ApiClient {
object ApiClientConfig {
private const val ConfigURL = "https://vungles.com/api/test/" // BASE 请求配置文件地址 见说明文档
// private const val ConfigURL = "https://uuvpn.oss-cn-hongkong.aliyuncs.com/api/test/" // BASE 请求配置文件地址 见说明文档
//这个链接主要是为了配置转化,一般有的订阅地址被墙之后国内无法访问,这里就是了防止被墙,使用我们的香港服务器进行顶级域名防护
//const val ConfigNodeURL = "https://api.xxxx.com/api/parseyamlclash.php?target=clashmeta&url=" //通过香港服务器转接一次Clash转化的订阅地址
const val ConfigNodeURL = ""
@@ -143,10 +143,10 @@ suspend fun <T> safeApiCall(
null
}
} catch (e: TimeoutException) {
println("请求超时,请检查网络连接")
println("请求超时,请检查网络连接: ${e.message}")
null
} catch (e: IOException) {
println("网络错误,请检查网络连接")
println("网络错误,请检查网络连接: ${e.message}")
null
} catch (e: Exception) {
println("未知错误: ${e.message}")
@@ -4,6 +4,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission
@@ -15,13 +17,15 @@
android:name=".ClashService"
android:exported="false"
android:label="@string/clash_meta_for_android"
android:process=":background" />
android:process=":background"
android:foregroundServiceType="specialUse" />
<service
android:name=".TunService"
android:exported="false"
android:label="@string/clash_meta_for_android"
android:permission="android.permission.BIND_VPN_SERVICE"
android:process=":background">
android:process=":background"
android:foregroundServiceType="specialUse">
<intent-filter>
<action android:name="android.net.VpnService" />
</intent-filter>
@@ -29,11 +33,13 @@
<service
android:name=".RemoteService"
android:exported="false"
android:process=":background" />
android:process=":background"
android:foregroundServiceType="specialUse" />
<service
android:name=".ProfileWorker"
android:exported="false"
android:process=":background" />
android:process=":background"
android:foregroundServiceType="dataSync" />
<provider
android:name=".FilesProvider"