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 isPasswordVisible = false
private var configRetryCount = 0
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@@ -129,7 +130,9 @@ class LoginActivity : AppCompatActivity() {
private fun getconfig(){ private fun getconfig(){
LoadingDialog.show(this, "正在初始化...") runOnUiThread {
LoadingDialog.show(this, "正在初始化...")
}
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
safeApiCall {apiService.getConfig()}.let { safeApiCall {apiService.getConfig()}.let {
@@ -142,7 +145,15 @@ class LoginActivity : AppCompatActivity() {
//重新初始化 ApiClint //重新初始化 ApiClint
} }
}else{ }else{
getconfig() 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 minSdk = 24
compileSdkVersion(34) compileSdkVersion(34)
// targetSdkVersion(34) targetSdkVersion(34)
versionName = "3.1.0" versionName = "3.1.0"
versionCode = 323001 versionCode = 323001
@@ -140,8 +140,8 @@ subprojects {
buildTypes { buildTypes {
named("release") { named("release") {
isMinifyEnabled = isApp isMinifyEnabled = false
isShrinkResources = isApp isShrinkResources = false
signingConfig = signingConfigs.findByName("release") signingConfig = signingConfigs.findByName("release")
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), 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) add_library(bridge SHARED main.c jni_helper.c bridge_helper.c)
target_link_libraries(bridge log clash) 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,9 +18,19 @@ object ApiClient {
.build() .build()
// Lazy initialization of configURL // Lazy initialization of configURL
private val configURL: String by lazy { private val configURL: String
PreferenceManager.baseURL 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
}
}
}
// Retrofit initialization // Retrofit initialization
@@ -34,7 +44,9 @@ object ApiClient {
} }
object ApiClientConfig { object ApiClientConfig {
private const val ConfigURL = "https://vungles.com/api/test/" // BASE 请求配置文件地址 见说明文档 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 = "https://api.xxxx.com/api/parseyamlclash.php?target=clashmeta&url=" //通过香港服务器转接一次Clash转化的订阅地址
const val ConfigNodeURL = "" const val ConfigNodeURL = ""
@@ -143,10 +143,10 @@ suspend fun <T> safeApiCall(
null null
} }
} catch (e: TimeoutException) { } catch (e: TimeoutException) {
println("请求超时,请检查网络连接") println("请求超时,请检查网络连接: ${e.message}")
null null
} catch (e: IOException) { } catch (e: IOException) {
println("网络错误,请检查网络连接") println("网络错误,请检查网络连接: ${e.message}")
null null
} catch (e: Exception) { } catch (e: Exception) {
println("未知错误: ${e.message}") println("未知错误: ${e.message}")
@@ -4,6 +4,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <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" />
<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.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission <uses-permission
@@ -15,13 +17,15 @@
android:name=".ClashService" android:name=".ClashService"
android:exported="false" android:exported="false"
android:label="@string/clash_meta_for_android" android:label="@string/clash_meta_for_android"
android:process=":background" /> android:process=":background"
android:foregroundServiceType="specialUse" />
<service <service
android:name=".TunService" android:name=".TunService"
android:exported="false" android:exported="false"
android:label="@string/clash_meta_for_android" android:label="@string/clash_meta_for_android"
android:permission="android.permission.BIND_VPN_SERVICE" android:permission="android.permission.BIND_VPN_SERVICE"
android:process=":background"> android:process=":background"
android:foregroundServiceType="specialUse">
<intent-filter> <intent-filter>
<action android:name="android.net.VpnService" /> <action android:name="android.net.VpnService" />
</intent-filter> </intent-filter>
@@ -29,11 +33,13 @@
<service <service
android:name=".RemoteService" android:name=".RemoteService"
android:exported="false" android:exported="false"
android:process=":background" /> android:process=":background"
android:foregroundServiceType="specialUse" />
<service <service
android:name=".ProfileWorker" android:name=".ProfileWorker"
android:exported="false" android:exported="false"
android:process=":background" /> android:process=":background"
android:foregroundServiceType="dataSync" />
<provider <provider
android:name=".FilesProvider" android:name=".FilesProvider"