Status Update
Comments
ba...@google.com <ba...@google.com>
ga...@linecorp.com <ga...@linecorp.com> #2
enableUnitTestCoverage = false
enableAndroidTestCoverage false
Thinks started to work again.
But for what it is worth - the error message could have been more helpful.
ba...@google.com <ba...@google.com>
tr...@google.com <tr...@google.com>
je...@google.com <je...@google.com>
bi...@google.com <bi...@google.com> #3
Well the error message is that it tried to configure jacoco task and failed, so it works for you because you disabled the feature.
So the error message is indicative of a bigger problem. Oviously, 8.2 is pretty old for us, not sure you are interested in trying 8.8.
The easiest would be to have a project reproducing the issue, if that's possible, we'll look into it.
am...@google.com <am...@google.com> #4
Unfortunately we haven't had the resources to keep things up to date for a long time - and now every possible problem is just piling up...
I'll get back once we manage to upgrade to 8.8...
ga...@linecorp.com <ga...@linecorp.com> #5
tl;dr: the issue is that an "empty" MainActivity.kt class fails to compile using a preview VIC SDK:
:lib:hostconfig
gradle subproject contains generated java source code only by BuildConfig
feature of AGP.
Generated source code is
$ cat lib/hostconfig/build/generated/source/buildConfig/debug/com/example/hostconfig/BuildConfig.java
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.hostconfig;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String LIBRARY_PACKAGE_NAME = "com.example.hostconfig";
public static final String BUILD_TYPE = "debug";
// Field from default config.
public static final String HOST = String.valueOf("https://api.example.com");
}
And it looks compiler warning is from using String.valueOf()
in build script.
After comment out of
bi...@google.com <bi...@google.com> #6
To add on top of #4 and #5, the problem is we cannot simply compile the following code, targeting Java 9+(where we create jdk image with android sdk). It is not specific to build files. Any idea on how Flagged api gets involved in this?
String myStr = String.valueOf("strValue")
btw I assume android build would also have this issue @ccross
bi...@google.com <bi...@google.com> #7
Bump to P1 because it is not specific to this String.valueOf
API but java compilation targeting 9+ is broken with VanillaIceCream. The error message is always the
/modules/java.base/java/lang/CharSequence.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi': class file for android.annotation.FlaggedApi not found
pa...@google.com <pa...@google.com> #8
I'm not 100% sure why javac
needs to access the definition of the FlaggedApi
class on the CharSequence
class but the reference comes from
The FlaggedApi
class is currently defined in two places:
- In
for use when building the platform and mainline modules.framework-annotations - In
in Metalava for use when compiling stubs generated by Metalava.stub-annotations
In order to make it available alongside java/lang/CharSequence
at compile time it will be necessary to include it in the core-for-system-modules.jar
. Doing that could potentially cause conflicts with the class in the above two libraries.
Making that work internally will be complicated.
bi...@google.com <bi...@google.com> #9
To correct #7 a bit, I am able to reproduce with reporter's project but "not" with a template project with the following setup
- add
android.compileSdkPreview="VanillaIceCream"
- add a java source with usage of
String myStr = String.valueOf("strValue")
- set source/target compatibility to java 11
I am trying to figure out what could make a difference here.
ga...@linecorp.com <ga...@linecorp.com> #10
Additional Info:
Not only String.valueOf
, but valueOf()
methods can raise similar warnings for other types.
$ cat lib/hostconfig/src/main/java/test.java
class test {
public int field1 = Integer.valueOf(1);
public long field2 = Long.valueOf(2);
public float field3 = Float.valueOf(3);
}
$ ./gradlew \
:lib:hostconfig:assembleDebug \
-PcompileSdkPreview=VanillaIceCream
> Task :lib:hostconfig:compileDebugJavaWithJavac FAILED
/modules/java.base/java/lang/Character.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi': class file for android.annotation.FlaggedApi not found
/modules/java.base/java/lang/Character.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/lang/Float.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
error: warnings found and -Werror specified
1 error
3 warnings
bi...@google.com <bi...@google.com> #11
I think there is something happening in the build-logic
project. If I don't apply the com.myapplication.android.builder
plugins from build-logic
in build.gradle
of the root project, the compilation error of lib/hostconfig
is gone.
Forget to mention, I set source/target compatibility to Java 11 in lib/hostconfig
Downgrade to p2 as it might be caused by some custom set up for compilation.
ga...@linecorp.com <ga...@linecorp.com> #12
so...@google.com <so...@google.com> #13
Re
I'm not 100% sure why javac needs to access the definition of the FlaggedApi class on the CharSequence class but the reference comes from here.
We need to add the flags to the new API. Though our expectation was that these would be stripped by the time android.jar
is generated. The flags are relevant at system build time. And the flagged API should be kept, or removed, from the android.jar
based on the flag status.
bi...@google.com <bi...@google.com> #14
re #12, thank for pointing that out. It is indeed the "-Werror"
compiler option that makes a difference.
ga...@linecorp.com <ga...@linecorp.com> #15
FYI
I found same compiler warning can be raised by generated code from Room compiler.
ex:
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation"})
public final class SomeDao_Impl implements SomeDao {
...
@NonNull
public static List<Class<?>> getRequiredConverters() {
return Collections.emptyList();
}
}
> Task :room:compileDebugJavaWithJavac FAILED
/modules/java.base/java/util/Collections.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi': class file for android.annotation.FlaggedApi not found
/modules/java.base/java/util/Collections.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/util/Collections.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/util/Collections.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/util/Collections.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/util/List.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
/modules/java.base/java/util/List.class: warning: Cannot find annotation method 'value()' in type 'FlaggedApi'
Description
Reproducible minimal-reproducible-example :https://github.com/ganadist/minimal-reproducible-example/
Preview VanillaIceCream SDK revision is r4.