Status Update
Comments
sg...@google.com <sg...@google.com> #2
cl...@google.com <cl...@google.com> #3
Sgjesse asked the following questions on stack overflow:
- Does both classes3.dex and classes4.dex only have classes with the j$ prefix?
- What happens if you just remove classes3.dex (the one missing the method) from the apk?
- Can you share a project with this issue, or a simple example project using the pricboxt dependency demonstrating the issue?
- can you share the apk with the issue?
Waiting for the reporter answers.
It looks like for some reasons the application is building 2 desugared library dex files with different sets of keep rules, messing up the apk. This is a multidex application with minSDK 16, that may be related to the problem.
sg...@google.com <sg...@google.com> #4
Just looked at the apk
that the developer shared, and found:
- Only
classes3.dex
havej$
classes, andj$.util.concurrent.ConcurrentHashMap
does not definenewKeySet
. - In
classes4.dex
the following two invokes are present:
grep -r newKeySet app-debug/smali_classes4
app-debug/smali_classes4/org/pircbotx/hooks/managers/ThreadedListenerManager.smali: invoke-static {}, Lj$/util/concurrent/ConcurrentHashMap;->newKeySet()Lj$/util/concurrent/ConcurrentHashMap$KeySetView;
app-debug/smali_classes4/org/pircbotx/hooks/managers/ThreadedListenerManager.smali: invoke-static {}, Lj$/util/concurrent/ConcurrentHashMap;->newKeySet()Lj$/util/concurrent/ConcurrentHashMap$KeySetView;
Could be an issue with the generated keep rules.
cl...@google.com <cl...@google.com> #5
I don't think it's a keep rule issue.
I think it's a problem with covariant return type and ConcurrentHashMap APIs. ConcurrentHashMap in the desugared library does not expose the KeySetView type and keep Java 7 return types (Set).
In
// For desugar: keep Java 7 API, don't expose KeySetView for now
// public KeySetView<K,V> keySet() {
public Set<K> keySet() {
Now when I look in the documentation (
public ConcurrentHashMap.KeySetView keySet(Object mappedValue)
public static ConcurrentHashMap.KeySetView newKeySet()
public static ConcurrentHashMap.KeySetView newKeySet(int initialCapacity)
So I understand someone got confused because the doc says it's supported while obviously it's not.
I think we should sync by visio on how we should proceed here.
cl...@google.com <cl...@google.com> #6
At his point we don't support the 3 methods.
mr...@gmail.com <mr...@gmail.com> #7
cl...@google.com <cl...@google.com> #8
Sorry I did not elaborate I did not think you would check.
I filed in a feature request (
At this point the 3 methods are not supported and we are going to update the documentation as soon as possible to strip them out.
Description
From Stackoverflow :
I'm attempting to use the new desugaring features in AGP, however I am getting the following error when trying to use
ConcurrentHashMap.newKeySet()
in my app:I have the following in my top level
build.gradle
and in my module
build-gradle
:Looking at the APK analyser. I can see that
j$.util.concurrent.ConcurrentHashMap
is defined inclasses3.dex
but does not include thenewKeySet
method. Howeverj$.util.concurrent.ConcurrentHashMap
is also defined inclasses4.dex
and does have this method!The
ConcurrentHashMap.newKeySet
call I am trying to work around is in the pircbotx dependency. However I have put a call to this method in my Application'sonCreate
method and this also crashes the app.Thanks in advance for any help. I've been at this for hours now to no avail.