🏃‍♂️ Fast : An Efficient Way to Build Extensions

Build failed after a long warnings from proguard with fast build -r even I have -dontwarn flag

1 Like

Please provide more information so that I can understand the issue to help you out.

1 Like
ds on program class com.google.gson.stream.JsonWriter
  - Warning: library class com.google.gson.internal.bind.TypeAdapters$20$1 depends on program class com.google.gson.stream.JsonReader
  - Warning: library class com.google.gson.internal.bind.TypeAdapters$20$1 depends on program class com.google.gson.stream.JsonWriter
  - Warning: there were 4545 unresolved references to classes or interfaces.
            You may need to add missing library jars or update their versions.
            If your code works fine without the missing classes, you can suppress
            the warnings with '-dontwarn' options.
            (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedclass)
  - Warning: there were 389 instances of library classes depending on program classes.
            You must avoid such dependencies, since the program classes will
            be processed, while the library classes will remain unchanged.
            (https://www.guardsquare.com/proguard/manual/troubleshooting#dependency)
  - Warning: there were 54 unresolved references to program class members.
            Your input classes appear to be inconsistent.
            You may need to recompile the code.
            (https://www.guardsquare.com/proguard/manual/troubleshooting#unresolvedprogramclassmember)
  - Unexpected error
  - java.io.IOException: Please correct the above warnings first.
   	at proguard.Initializer.execute(Initializer.java:526) ~[p8.jar:7.6.0]
   	at proguard.pass.PassRunner.run(PassRunner.java:24) ~[p8.jar:7.6.0]
   	at proguard.ProGuard.initialize(ProGuard.java:353) ~[p8.jar:7.6.0]
   	at proguard.ProGuard.execute(ProGuard.java:142) ~[p8.jar:7.6.0]
   	at proguard.ProGuard.main(ProGuard.java:648) [p8.jar:7.6.0]
x BUILD FAILED!

My proguard rules

# Repackages optimized classes into pk.sessionrecord.sessionrecord.repacked package in resulting
# AIX. Repackaging is necessary to avoid clashes with the other extensions that
# might be using same libraries as you.
-repackageclasses pk.sessionrecord.sessionrecord.repacked
-dontwarn

My fast.yml

# The name of the extension developer
author: Test

# If enabled, the version number of every component will be increased automatically.
auto_version: true

# The minimum Android SDK level your extension supports. Minimum SDK defined in
# AndroidManifest.xml or @DesignerComponent are ignored, you should always define it here.
min_sdk: 26

# If enabled, Kotlin Standard Libraries (V1.9.24) will be included with the extension.
# If you want to add specific Kotlin Standard Libraries so disable it.
kotlin: false

# If enabled, you will be able to use Java 8 language features in your extension source code.
# When you use .kt classes, by default Fast will desugar sources.
desugar_sources: false

# Enable it, if any of your dependencies use Java 8 language features.
# If kotlin is enabled, by default Fast will desugar dependencies.
desugar_deps: false

# If enabled, the D8 tool will generate desugared (classes.jar) classes.dex
desugar_dex: false

# If enabled, @annotations will be not present in built extension.
deannonate: true

# If enabled, matching classes provided by MIT will not be included in the built extension.
filter_mit_classes: false

# If enabled, it will optimizes the extension with ProGuard.
proguard: true

# If enabled, R8 will be used instead of ProGuard and D8 dexer.
# NOTE: It's an experimental feature.
R8: false

# Extension dependencies (JAR) [Should be present into deps directory]
dependencies:
 - annotation-1.0.0.jar
 - annotation-1.1.0.jar
 - annotation-1.2.0.jar
 - annotation-experimental-1.1.0.aar
 - annotation-experimental-1.1.0.jar
 - annotations-13.0.jar
 - collection-1.0.0.jar
 - core-1.5.0.aar
 - core-1.5.0.jar
 - core-common-2.0.0.jar
1 Like

You're doing wrong in rules. You need to define the package/class name with the -dontwarn attribute.

-dontwarn com.google.gson.internal.bind.**
dependencies:
 # - annotation-1.1.0.jar
 - annotation-experimental-1.1.0.jar
 - annotations-13.0.jar
# - collection-1.0.0.jar
# - core-1.5.0.jar
# - core-common-2.0.0.jar

And you're trying to override AI2 provided libraries. If you still want to override provided classes so you need to enable the filter_mit_classes attribute from the fast.yml. Otherwise, you'll get apk build failed issue.

And you don't need to use aar when you're declaring jar. Or if you declare aar instead of jar, you need to run once fast sync before build.

1 Like

Thanks a lot, issue is resolved

2 Likes

You're welcome :bouquet:

2 Likes

After this suggestion I looked at the proguard configuration in more detail and there was indeed a mistake:

I'm not sure if this is necessary, but if so, the name of the entire Integer class is missing here.
public Integer toUnderlyingValue();

It should be:
public java.lang.Integer toUnderlyingValue();

1 Like

These rules will be sufficient to keep all required things from the helper class.

-keep enum pl.patryk_f.extension.helpers.MyIcon {
 public protected *;
 public static **[] values();
 public static ** valueOf(java.lang.String);
}

FAST will handle it by default from the next update v1.2.8.

1 Like

:mega: An update is available v1.2.8

Date built: 13.11.24.15.09


  • Modified the default ProGuard rules to keep all required methods and values from helper classes.
1 Like

Wasn't this introduced in an earlier version?

1 Like

FAST was keeping helper classes, but there was an issue. I've fixed it in v.1.2.8. You could also do the same from earlier version of FAST by using custom rules with the proguard-rules.pro.

1 Like

Please make sure the @DesignerComponent annotation is present in your component source code.

See here.

2 Likes

Excellent and very fast! Thank you @JEWEL .

3 Likes

You're welcome @Passos_0213 :bouquet:

3 Likes

The ListView component has changed, its new methods are not available in Fast.

3 Likes

If you are referring to these changes, you only need to add the dynamicanimation-1.0.0.jar into Fast/libs/appinventor/ and I will include it with the next update.

1 Like

I mean the AndroidRuntime library.

2 Likes

Thanks, I've also noticed that after wrote my last reply. I think I've to build the AI2 source to get the latest AndroidRuntime.jar.

1 Like

:pushpin: FAST will require a minimum of JDK11 after these changes are implemented.

3 Likes

Hi @JEWEL
I am use -o build flag and then extension size increase.
How can work this flag?

1 Like