1、服务器抠图添加decode
2、添加打包脚本
This commit is contained in:
shenzuqiang 2026-03-13 10:43:42 +08:00
parent 818d285ccb
commit ec0149decb
4 changed files with 18 additions and 108 deletions

View File

@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2026-03-12T10:17:50.197535700Z">
<DropdownSelection timestamp="2026-03-13T02:12:15.837405600Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=JRBI89BIE6AI5TG6" />
<DeviceId pluginId="PhysicalDevice" identifier="serial=Y5DELZR46DZTCI9D" />
</handle>
</Target>
</DropdownSelection>

View File

@ -123,122 +123,29 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
//noinspection WrongGradleMethod
androidComponents {
onVariants { variant ->
variant.outputs.forEach { output ->
// 关键:强制转换为 VariantOutputImpl 以访问 outputFileName
val outputImpl = output as? com.android.build.api.variant.impl.VariantOutputImpl
val flavor = variant.flavorName ?: "default"
val buildType = variant.buildType ?: "release"
val versionName = android.defaultConfig.versionName ?: "1.0.0"
// 输出格式: Rabbit_huawei_release_v1.0.0.apk
outputImpl?.outputFileName?.set("Rabbit_${flavor}_${buildType}_v${versionName}.apk")
}
}
/*
android {
namespace = "com.img.rabbit"
compileSdk = 36
buildFeatures {
compose = true
buildConfig = true
viewBinding = true
}
aaptOptions {
additionalParameters("--auto-add-overlay")
}
androidResources {
ignoreAssetsPattern = "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.8"
}
defaultConfig {
applicationId = "com.img.rabbit"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0.0"
multiDexEnabled = true
setManifestPlaceholders(mapOf(
"GETUI_APPID" to (project.findProperty("GETUI_APPID") as? String ?: ""),
"GT_INSTALL_CHANNEL" to (project.findProperty("GT_INSTALL_CHANNEL") as? String ?: "GT_INSTALL_CHANNEL")
))
ndk {
abiFilters.addAll(listOf("arm64-v8a", "x86_64", "x86", "armeabi-v7a"))
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
multiDexEnabled = true
resConfigs("en", "zh-rCN")
flavorDimensions.addAll(listOf("channel"))
productFlavors {
create("general") {
dimension = "channel"
manifestPlaceholders["UMENG_CHANNEL"] = "general"
}
}
productFlavors.configureEach {
dimension = "channel"
manifestPlaceholders.putAll(mapOf("UMENG_CHANNEL" to name))
}
manifestPlaceholders.putAll(mapOf(
"GETUI_APPID" to (project.findProperty("GETUI_APPID") as? String ?: ""),
"GT_INSTALL_CHANNEL" to "general",
"apk.applicationId" to "com.img.rabbit",
))
}
// 配置签名信息
signingConfigs {
create("config") {
storeFile = file(project.findProperty("RELEASE_STORE_FILE") ?: "bidinfo.keystore")
storePassword = project.findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
keyAlias = project.findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
keyPassword = project.findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
}
}
buildTypes {
getByName("debug") {
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("config")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
getByName("release") {
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("config")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
*/
configurations {
all {
@ -246,6 +153,9 @@ configurations {
}
}
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.addAll(listOf("-Xlint:unchecked", "-Xlint:deprecation"))
}
dependencies {
api(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar","*.aar"))))

View File

@ -98,7 +98,7 @@ final class ApkUtil {
public static Map<Integer, ByteBuffer> findIdValues(ByteBuffer apkSigningBlock) throws SignatureNotFoundException {
checkByteOrderLittleEndian(apkSigningBlock);
ByteBuffer pairs = sliceFromTo(apkSigningBlock, 8, apkSigningBlock.capacity() - 24);
Map<Integer, ByteBuffer> idValues = new LinkedHashMap();
Map<Integer, ByteBuffer> idValues = new LinkedHashMap<>();
int entryCount = 0;
while(pairs.hasRemaining()) {
++entryCount;

View File

@ -78,7 +78,7 @@ class CutoutViewModel : BaseViewModel() {
if (response.status) {
Log.i("CutoutViewModel", "抠图成功: ${response.data}")
val resultUrl = response.data.toString()
val resultUrl = Uri.decode(response.data.toString())
// 将 http 替换为 https
//val resultUrl = response.data.toString().replace("http://", "https://")
saveUrlToCache(resultUrl, onResult)