Optimize apk size again (#267)

This commit is contained in:
vvb2060 2021-03-05 03:03:59 +08:00 committed by GitHub
parent 300b7557c0
commit 1a5f809634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 5 deletions

View File

@ -68,6 +68,7 @@ android {
packagingOptions {
resources {
excludes += "META-INF/**"
excludes += "okhttp3/**"
excludes += "kotlin/**"
excludes += "org/**"
excludes += "**.properties"

View File

@ -18,6 +18,7 @@
-repackageclasses
-allowaccessmodification
-overloadaggressively
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.

View File

@ -108,12 +108,15 @@ public class MainActivity extends BaseActivity {
}
} else {
cardBackgroundColor = ResourcesKt.resolveColor(getTheme(), R.attr.colorInstall);
boolean isMagiskInstalled = Arrays.stream(System.getenv("PATH").split(File.pathSeparator)).anyMatch(str -> new File(str, "magisk").exists());
boolean isMagiskInstalled = Arrays.stream(System.getenv("PATH").split(File.pathSeparator))
.anyMatch(str -> new File(str, "magisk").exists());
binding.statusTitle.setText(isMagiskInstalled ? R.string.Install : R.string.NotInstall);
binding.statusSummary.setText(isMagiskInstalled ? R.string.InstallDetail : R.string.NotInstallDetail);
if (!isMagiskInstalled) binding.status.setOnClickListener(null);
if (!isMagiskInstalled) {
binding.status.setOnClickListener(null);
binding.download.setVisibility(View.GONE);
}
binding.statusIcon.setImageResource(R.drawable.ic_error);
binding.download.setVisibility(View.GONE);
Snackbar.make(binding.snackbar, R.string.lsposed_not_active, Snackbar.LENGTH_LONG).show();
}
binding.status.setCardBackgroundColor(cardBackgroundColor);

View File

@ -38,14 +38,16 @@ public class DoHDNS implements Dns {
public DoHDNS() {
DnsOverHttps.Builder builder = new DnsOverHttps.Builder()
.resolvePrivateAddresses(true)
.resolvePublicAddresses(true)
.client(new OkHttpClient.Builder().build())
.url(HttpUrl.get("https://cloudflare-dns.com/dns-query"));
try {
builder.bootstrapDnsHosts(InetAddress.getByName("162.159.36.1"),
builder.bootstrapDnsHosts(
InetAddress.getByName("162.159.36.1"),
InetAddress.getByName("162.159.46.1"),
InetAddress.getByName("1.1.1.1"),
InetAddress.getByName("1.0.0.1"),
InetAddress.getByName("162.159.132.53"),
InetAddress.getByName("2606:4700:4700::1111"),
InetAddress.getByName("2606:4700:4700::1001"),
InetAddress.getByName("2606:4700:4700::0064"),

View File

@ -23,8 +23,12 @@ buildscript {
repositories {
google()
mavenCentral()
maven {
setUrl("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:3.0.26-dev")
classpath("com.android.tools.build:gradle:7.0.0-alpha08")
classpath("org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r")
classpath(kotlin("gradle-plugin", version = "1.4.31"))