Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Android 14 #3165

Merged
merged 19 commits into from
Aug 28, 2024
Merged

Target Android 14 #3165

merged 19 commits into from
Aug 28, 2024

Conversation

AaronChen0
Copy link
Contributor

@AaronChen0 AaronChen0 commented Aug 26, 2024

This is an attempt to update shadowsocks-android to target Android 14 and its dependencies.

Please read this for changes in AGP8. Some build option default values change.

The build succeeded and the debug apk works in both my android 14 and android 12 phones.
You can try a debug build apk here.
The debug build log can be found here.

Main updates:

@AaronChen0
Copy link
Contributor Author

In a release branch here, the build will fail with the following R8 missing class errors:

WARNING: /home/circleci/code/mobile/build/intermediates/merged_java_res/release/mergeReleaseJavaResource/base.jar: R8: Unexpected reference to missing service class: META-INF/services/java.net.spi.InetAddressResolverProvider.
WARNING: /home/circleci/code/mobile/build/intermediates/merged_java_res/release/mergeReleaseJavaResource/base.jar: R8: Unexpected reference to missing service implementation class in META-INF/services/java.net.spi.InetAddressResolverProvider: org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider.
WARNING: /home/circleci/code/mobile/build/intermediates/merged_java_res/release/mergeReleaseJavaResource/base.jar: R8: Unexpected reference to missing service class: META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor.
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /home/circleci/code/mobile/build/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class lombok.Generated (referenced from: org.slf4j.Logger org.xbill.DNS.Compression.log and 3 other contexts)
Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts)
Missing class org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider (referenced from: java.util.List kotlinx.coroutines.internal.FastServiceLoader.load(java.lang.Class, java.lang.ClassLoader))
Missing class sun.net.spi.nameservice.NameServiceDescriptor (referenced from: org.xbill.DNS.spi.DNSJavaNameServiceDescriptor)

Adding the following to proguard-rules.pro fixes the R8 errors and the apk works normally.

-dontwarn java.net.spi.InetAddressResolverProvider
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider
-dontwarn sun.net.spi.nameservice.NameServiceDescriptor
-dontwarn lombok.Generated

I am not familiar with R8 proguard rules, should I just add dontwarn if the app works normally in my use?
Check the builds here.

@Mygod
Copy link
Contributor

Mygod commented Aug 26, 2024

Yes add these rules.

-dontwarn lombok.Generated
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider
-dontwarn sun.net.spi.nameservice.NameServiceDescriptor

core/src/main/AndroidManifest.xml Outdated Show resolved Hide resolved
mobile/src/main/AndroidManifest.xml Outdated Show resolved Hide resolved
@AaronChen0 AaronChen0 requested a review from Mygod August 27, 2024 02:59
@AaronChen0
Copy link
Contributor Author

Build successfully and work in my phones. Please review.

@Mygod
Copy link
Contributor

Mygod commented Aug 27, 2024

Thanks! And be patient while I download rust. :)

Copy link
Contributor

@Mygod Mygod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mygod Mygod merged commit 3e4d9e3 into shadowsocks:master Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants