适配Android 11

master
Matthew 12 months ago
parent af14323349
commit 0be21d5c38

@ -12,26 +12,26 @@ android {
buildConfig = true
}
signingConfigs {
AceKeystore {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
//signingConfigs {
// AceKeystore {
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile file(keystoreProperties['storeFile'])
// storePassword keystoreProperties['storePassword']
// }
//}
defaultConfig {
applicationId "io.github.acedroidx.frp"
minSdkVersion 23
targetSdkVersion 34
compileSdk 34
minSdkVersion 25
targetSdkVersion 30
compileSdk 31
versionCode 4
versionName "1.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.AceKeystore
// signingConfig signingConfigs.AceKeystore
buildConfigField("String", "FrpVersion", '"0.56.0"')
buildConfigField("String", "FrpcFileName", '"libfrpc.so"')
@ -43,15 +43,15 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.AceKeystore
// signingConfig signingConfigs.AceKeystore
}
debug {
signingConfig signingConfigs.AceKeystore
// signingConfig signingConfigs.AceKeystore
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '17'
@ -74,10 +74,10 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

@ -1,18 +1,59 @@
{
"version": 2,
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "io.github.acedroidx.frp",
"variantName": "processReleaseResources",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"type": "UNIVERSAL",
"filters": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
"attributes": [],
"versionCode": 4,
"versionName": "1.0.3",
"outputFile": "app-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 4,
"versionName": "1.0.3",
"outputFile": "app-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 4,
"versionName": "1.0.3",
"outputFile": "app-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 4,
"versionName": "1.0.3",
"outputFile": "app-armeabi-v7a-release.apk"
}
]
],
"elementType": "File"
}

@ -26,7 +26,7 @@
android:name=".ShellService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="specialUse">
android:foregroundServiceType="camera">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="explanation_for_special_use" />

@ -1,15 +1,20 @@
serverAddr = ""
serverAddr = "61.169.135.146"
serverPort = 7000
dnsServer = "114.114.114.114"
auth.method = "token"
auth.token = "mint"
transport.tls.enable=false
transport.tls.disableCustomTLSFirstByte = false
[log]
level = "debug"
disablePrintColor = true
[[visitors]]
name = "p2p_visitor"
[[proxies]]
name = "p2p_adb"
type = "xtcp"
serverName = ""
secretKey = ""
bindAddr = "127.0.0.1"
bindPort = 6000
secretKey = "123456"
localIP = "127.0.0.1"
localPort = 5555

@ -50,6 +50,8 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var startFrp = intent.getIntExtra("startFrp",0)
val versionName = packageManager.getPackageInfo(packageName, 0).versionName
val titleText = findViewById<TextView>(R.id.titleText)
titleText.text = "frp for Android - ${versionName}/${BuildConfig.FrpVersion}"
@ -60,7 +62,7 @@ class MainActivity : AppCompatActivity() {
mBound = isServiceRunning(ShellService::class.java)
state_switch = findViewById<SwitchCompat>(R.id.state_switch)
state_switch.isChecked = mBound
state_switch.isChecked = mBound || (startFrp != 0)
state_switch.setOnCheckedChangeListener { buttonView, isChecked -> if (isChecked) (startShell()) else (stopShell()) }
val editor = getSharedPreferences("data", AppCompatActivity.MODE_PRIVATE)
auto_start_switch = findViewById<SwitchCompat>(R.id.auto_start_switch)
@ -147,6 +149,7 @@ class MainActivity : AppCompatActivity() {
// decision.
}
}
/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(
this, Manifest.permission.POST_NOTIFICATIONS
@ -155,6 +158,8 @@ class MainActivity : AppCompatActivity() {
requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}
*/
}
private fun createBGNotificationChannel() {

@ -106,11 +106,12 @@ class ShellService : Service() {
.setContentText("已启动frp")
//.setTicker("test")
.setContentIntent(pendingIntent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return notification.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE)
.build()
} else {
return notification.build()
}
}*/
return notification.build()
}
}

@ -1,12 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.9.20"
ext.kotlin_version = "1.6.10"
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.1'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
@ -17,6 +18,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

@ -1,6 +1,6 @@
#Thu Mar 24 09:47:16 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-1-bin.zip
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

@ -1,4 +0,0 @@
storeFile=C:\\path\\to\\Keystore.jks
storePassword=
keyAlias=
keyPassword=

Binary file not shown.
Loading…
Cancel
Save