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

Error while dexing in android version 2.0.11.0 #301

Open
alekw opened this issue Dec 11, 2024 · 12 comments
Open

Error while dexing in android version 2.0.11.0 #301

alekw opened this issue Dec 11, 2024 · 12 comments

Comments

@alekw
Copy link

alekw commented Dec 11, 2024

Hello,
I was trying to embedd some torrent client with in android java app.
I am rather C# dev, so sorry if that is obvious mistake or too little details
I failed with libtorrent4j, so I moved here. With stable version as in frostwire for android, app builds ok.
When build with latest beta version 2.0.11.0, I am getting:

`

Task :app:desugarDebugFileDependencies FAILED
Execution failed for task ':app:desugarDebugFileDependencies'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Error while dexing.
`

I am using (min/compile/target) sdkversion 28, but with different versions I did not see any changes.

Just reporting the bug, I can stay on stable version for my work.

BTW what is the difference between libtorrent4j and jlibtorrent nowadays? Which one should I use for new development?

Best regards

@gubatron
Copy link
Collaborator

hmm, that's a really vague error, please try sharing more of the output

@gubatron
Copy link
Collaborator

are you including all of the .jar files?

you want to include the jar with just the classes, along with the other jars that have the binaries, do not extract them, perhaps you added the .so files straight up?

@alekw
Copy link
Author

alekw commented Dec 12, 2024

are you including all of the .jar files?

you want to include the jar with just the classes, along with the other jars that have the binaries, do not extract them, perhaps you added the .so files straight up?

Hi, thanks for swift reply. Yes, I include total 5 files, exactly like here: https://github.com/frostwire/frostwire/tree/master/android/libs
If I include 1.2.19.0, it is compiling.
If I replace them with 2.0.11.0 and change this line in build.gradle:
def jlibtorrent_version = '1.2.19.0' I got this error.

I dont have my work laptop with me, but this is very easy to reproduce:

@gubatron
Copy link
Collaborator

hmm, wonder if we didn't update the version number somewhere for 2.0.11.0

Are you including the jars here?
https://github.com/frostwire/frostwire-jlibtorrent/releases/tag/release%2F2.0.11.0

@gubatron
Copy link
Collaborator

Also, please don't loook at FrostWire's source code right now, FrostWire is still on jlibtorrent 1.2x, we'll be releasing a 2.0 based version in 2025.

@alekw
Copy link
Author

alekw commented Dec 12, 2024

Yes, I am including jars from the link you posted.
I believe you will face that issue if you bump version in Frost bite android client, maybe tomorrow I will prepare example.
Problem is in jlibtorrent-2.0.11.0.jar file, when I remove it project builds, but most likely will not work :)

@gubatron
Copy link
Collaborator

it's going to be a lot more than changing the jars :)

otherwise we would've released already.

There's a TON of API breaking changes from 1.2.x to 2.0.x

@gubatron
Copy link
Collaborator

busy now trying to get android to work with SDK 34+

I'm hoping to merge this today (Android 34+ compatibility)
frostwire/frostwire@master...upgrade-target-sdk-version-34

Once we got that merged and out we'll start the Jlibtorrent 2.0 migration for android and desktop.

@alekw
Copy link
Author

alekw commented Dec 12, 2024

it's going to be a lot more than changing the jars :)

otherwise we would've released already.

There's a TON of API breaking changes from 1.2.x to 2.0.x

Right, but I was just starting development of POC. I had no code yet and could not compile, and it makes sense for me to start with 2.x version to avoid breaking changes. But anyway I just need to download torrent with HTTPS url seed and seed it for few minutes after, so there wont be a lot of work to update it next year to 2.x.

@gubatron
Copy link
Collaborator

give me a week and ill be testing the api on android

@gubatron
Copy link
Collaborator

update: done with the android sdk 34+ update, I can now start a new branch to start integrating jlibtorrent 2.0, I'll keep you posted if I come across this DEXING issue and how I solve it. I'll also let you know if I don't have any issues, in which case I'll tell you to look at our Android project files, for now I leave you these to compare against yours:

gradle.properties

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m
org.gradle.jvmargs=-Xmx2560m -XX:+UseParallelGC

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=false
org.gradle.daemon=false

android.useAndroidX=true
android.enableJetifier=false

# Aug 23 2019, to solve "API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'"
android.debug.obsoleteApi=true
android.nonTransitiveRClass=true
android.nonFinalResIds=false

# Nov 23, 2021
# Uncomment to override path of JDK used by gradle, or pass in the command line
# as -Dorg.gradle.java.home=<path to jdk>
# Gradle isn't liking jdk 17 for now, which is my default
#org.gradle.java.home=/Users/gubatron/src/jdk-15.0.1.jdk/Contents/Home

DEXing issues are often also caused by proguard-rules.pro
Here is ours before migrating to jlibtorrent 2:

# okhttp3
-dontwarn okhttp3.**
-dontwarn okio.**
#D8: Type `org.conscrypt.Conscrypt` was not found
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn javax.annotation.**
-keep class androidx.lifecycle.** { *; }
-keep class okhttp3.Headers { *; }
-keep class org.apache.http.client.utils.URLEncodedUtils { *; }
-keep class org.conscrypt.Conscrypt { *; }
-keep class org.conscrypt.org.Conscrypt$ProviderBuilder { *; }
#-keep class androidx.core.view.accessibility.AccessibilityManagerCompat$TouchExplorationStateChangeListenerWrapper { *; }
-keep class android.net.http.AndroidHttpClient { *; }
-keep class androidx.core.app.CoreComponentFactory { *; }
-keep class org.conscrypt.ConscryptHostnameVerifier { *; }
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase {
    void <init>();
}


#  VUNGLE
-dontwarn com.vungle.**
-dontnote com.vungle.**
-keep class com.vungle.** { *; }
-keep class javax.inject.* {
    void <init>();
}
-dontwarn de.greenrobot.event.util.**
-dontwarn rx.internal.util.unsafe.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-keep class rx.schedulers.Schedulers { public static <methods>; }
-keep class rx.schedulers.ImmediateScheduler { public <methods>; }
-keep class rx.schedulers.TestScheduler { public <methods>; }
-keep class rx.schedulers.Schedulers { public static ** test(); }
# EOVUNGLE

# MoPub
-keep class com.mopub.mobileads.WebViewCacheService { *; }
-dontwarn com.mopub.common.MoPubReward
-dontwarn com.mopub.nativeads.*
-dontwarn com.mopub.mobileads.MoPubRewardedVideoManager
-dontwarn com.mopub.mobileads.CustomEventRewardedVideo

-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.OpenSSLProvider

# Applovin
-keepattributes Signature,InnerClasses,Exceptions,Annotation
-keep public class com.applovin.sdk.AppLovinSdk{ *; }
-keep public class com.applovin.sdk.AppLovin* { public protected *; }
-keep public class com.applovin.nativeAds.AppLovin* { public protected *; }
-keep public class com.applovin.adview.* { public protected *; }
-keep public class com.applovin.mediation.* { public protected *; }
-keep public class com.applovin.mediation.ads.* { public protected *; }
-keep public class com.applovin.impl.*.AppLovin { public protected *; }
-keep public class com.applovin.impl.**.*Impl { public protected *; }
-keepclassmembers class com.applovin.sdk.AppLovinSdkSettings { private java.util.Map localSettings; }
-keep class com.applovin.mediation.adapters.** { *; }
-keep class com.applovin.mediation.adapter.**{ *; }

# GoogleBillingClient
-keep class com.android.billingclient.api.BillingClientImpl$* { *; }

# jlibtorrent
-keep class com.frostwire.jlibtorrent.swig.libtorrent_jni {*;}

-keep class libcore.io.Memory { *; }

# chaquopy
-keep class com.chaquo.python.** { *; }
-dontwarn com.chaquo.python.**

# GMS
-keep public class com.google.android.gms.** { public protected *; }

# keep all constructors
-keep class * {
    <init>(...);
}

-keep public class * implements androidx.versionedparcelable.VersionedParcelable {
  <init>();
}

# to keep all the names and avoid code mangling
-keepnames class ** {*;}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-dontobfuscate
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable

@gubatron
Copy link
Collaborator

I think we'll also be doing this, if we have issues
#294

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

No branches or pull requests

2 participants