Status Update
Comments
bi...@google.com <bi...@google.com> #2
Using the same project, and running gw asDeb --configuration-cache
generates an HTML report (like e.g. file:///usr/local/google/home/gavra/AndroidStudioProjects/agp_r8_issue/build/reports/configuration-cache/71bxgz42iqmeflkzkeiz07rgj/exur7n03273b7z2r0b8e1z25h/configuration-cache-report.html
), which indicates that ShaderCompile
reads app/build/intermediates/merged_shaders/debug/out
at configuration time.
The issue is
@InputFiles
@IgnoreEmptyDirectories
@PathSensitive(PathSensitivity.RELATIVE)
@SkipWhenEmpty
public FileTree getSourceFiles() {
File sourceDirFile = getSourceDir().get().getAsFile();
FileTree src = null;
if (sourceDirFile.isDirectory()) {
src = getProject().files(sourceDirFile).getAsFileTree().matching(PATTERN_SET);
}
return src == null ? getProject().files().getAsFileTree() : src;
}
which should migrate to Provider.map {}
.
sg...@google.com <sg...@google.com> #3
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Giraffe Canary 1 (2022.3.1.1)
- Android Gradle Plugin 8.1.0
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
bi...@google.com <bi...@google.com> #4
2055-2
bi...@google.com <bi...@google.com> #5
Please my app launch
ga...@google.com <ga...@google.com> #6
...
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
...>
</application>
ch...@google.com <ch...@google.com> #7
The javax annotations should be in
For java.lang.management
you will likely need a -dontwarn
rule. (Ideally this would not be part of the live program, since this code is clearly not meant to be run on Android. This could require changes to jacoco, however.)
bi...@google.com <bi...@google.com>
bi...@google.com <bi...@google.com> #8
re #6, we do get warnings about missing classes which is the same as the one that we would get as errors if we don't add -ignorewarnings
.
WARNING:R8: Missing class com.google.j2objc.annotations.Weak (referenced from: java.util.concurrent.ConcurrentMap com.google.common.cache.LocalCache$AbstractCacheSet.map and 21 other contexts)
Missing class java.lang.ClassValue (referenced from: java.lang.ClassValue com.google.common.util.concurrent.FuturesGetChecked$GetCheckedTypeValidatorHolder$ClassValueValidator.isValidClass and 3 other contexts)
......
And I will make sure we wrap r8 error instead of throwing them directly.
bi...@google.com <bi...@google.com> #9
re #7, I fixed most of the missing class errors by adding corresponding dependencies. But I am not sure about java.lang.ClassValue
which is added from jdk to android recently(-dontwarn
rule for it.
bi...@google.com <bi...@google.com> #10
Ivan, just to clarify your comments about a helpful error message, you mean we want to have some error message in addition to showing the exception thrown from r8? The error message should contains some instructions on how to solve this problem? like "please add missing classes or add -dontwarn rule"
sg...@google.com <sg...@google.com> #11
Regarding java.lang.ClassValue
, adding a -dontwarn
it the right thing to do. If a developer use a dependency which has live references to java.lang.ClassValue
, then they have to explicitly consider that issue and add the warning. The concrete Guava use that you saw seems to be from the java.
types are common in libraries which are not explicitly designed for Android.
ga...@google.com <ga...@google.com> #12
Re #10: Yes, we should suggest a clear user action similar to the one we had in 7.x. If we can collect all missing dontwarn(s) and write them out to a file (as in 7.x) that'd be even better. Alternatively, if we get them one by one, we can output a better error message in stderr.
bi...@google.com <bi...@google.com> #13
Looks like we already have a clear user action thanks to our implementation here
=================== Stderr ===================
ERROR:Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in xxxxx/debug/missing_rules.txt.
This will become an error in AGP 8.0.
ERROR:R8: Missing class test.B (referenced from: test.B test.A.foo())
Missing class test.C (referenced from: test.C test.A.bar())
So we only need to change the error message a little bit.
bi...@google.com <bi...@google.com> #14
fixed with change Iee631c0faa8ac1b32579732dfd82f96921082672
[Deleted User] <[Deleted User]> #15
How do we experience this function(Don't add ignorewarnings )at AGP 4.2.2.
I wish you provide the 4.2.3 version to support it.
ey...@gmail.com <ey...@gmail.com> #16
I just updated to 8.0.0 alpha and started getting these errors:
ERROR:R8: Missing class android.support.v4.app.FragmentActivity (referenced from: void leakcanary.internal.AndroidSupportFragmentDestroyWatcher.invoke(android.app.Activity))
Missing class android.support.v4.app.FragmentManager$FragmentLifecycleCallbacks (referenced from: void leakcanary.internal.AndroidSupportFragmentDestroyWatcher$fragmentLifecycleCallbacks$1.<init>(leakcanary.internal.AndroidSupportFragmentDestroyWatcher) and 2 other contexts)
Missing class android.support.v4.app.FragmentManager (referenced from: void leakcanary.internal.AndroidSupportFragmentDestroyWatcher.invoke(android.app.Activity))
Missing class androidx.asynclayoutinflater.view.AsyncLayoutInflater$OnInflateFinishedListener (referenced from: void com.mapbox.maps.ViewAnnotationManagerImpl.addViewAnnotation(int, com.mapbox.maps.ViewAnnotationOptions, androidx.asynclayoutinflater.view.AsyncLayoutInflater, kotlin.jvm.functions.Function1))
Missing class androidx.asynclayoutinflater.view.AsyncLayoutInflater (referenced from: void com.mapbox.maps.ViewAnnotationManagerImpl.addViewAnnotation(int, com.mapbox.maps.ViewAnnotationOptions, androidx.asynclayoutinflater.view.AsyncLayoutInflater, kotlin.jvm.functions.Function1) and 1 other context)
Missing class androidx.work.multiprocess.RemoteListenableWorker (referenced from: leakcanary.internal.RemoteHeapAnalyzerWorker)
Do I just need to add the dontwarn
commands that are generated to my config, or should I report these somewhere (here, or the library that is mentioned)?
sg...@google.com <sg...@google.com> #17
The missing classes are from leakcanary
(Square) and com.mapbox.maps
(mapbox). If you don't have any control over these libraries adding the -dontwarn
is one option. Another option will be to add more dependencies to your project with the missing classes. The missing classes are in code which R8 did not remove, but of course that can still be code which will never be hit at runtime.
I suggest that you also report this to the library authors, so they can update their libraries to avoid consumers getting these errors. On the library side they can either 1) add more dependencies or 2) add the -dontwarn
to the library consumer keep rules. There can be good reasons for a library having missing classes if it has code which checks for different supported dependencies. E.g. leakcanary might work with both old support library and new Jetpack (androidx) libraries, so you chose the dependency and leakcanary will work with both.
Description
For AGP 8.0 we should remove the injection of -ignorewarnings , and make missing classes an error.