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

Greate work finally support aar files thank you :heart:

3 Likes

Also add proguard rules from aar file?

Although not all libraries in the extension can use proguard rules.

You're welcome :bouquet:

This is why I have skipped merging AndroidManifest.xml & proguard.txt from aar files. FAST collects all the necessary jars from those aars and converts (if exists) R.txt into a proper R.class, placing them right where they need to go.

3 Likes

This is indeed related to the "extension" itself.

Secondly, the error java.lang.VerifyError: Expecting a stackmap frame indicates a verification issue in the bytecode. This usually happens when the Java class file is compiled with a different java version than that used by appinventor.

Correct me if I'm wrong.

1 Like

I don't think so, I tried both java8 and java 11. I tried with and without desugaring. The compilation error only occurs when I pull the helpers block from the extension drawer and place it in the blocks workspace. I made a test extension without any libraries, only one function from the helpers block and it compiles correctly there. It doesn't work with my big extension and I have no idea what the reason is. Fortunately, I can live without helpers blocks :grin:

1 Like

I am getting this error

 Cleaning build caches
- Increasing Components version
- Compiling Kotlin classes
- Compiling Java classes
- Generating components info
  - WARNING: An illegal reflective access operation has occurred
  - WARNING: Illegal reflective access by org.jetbrains.kotlin.kapt3.util.ModuleManipulationUtilsKt (file:/Users/husnain/.local/share/Fast/lib/kotlinc/lib/kotlin-annotation-processing.jar) to constructor com.sun.tools.javac.util.Context()
  - WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.kapt3.util.ModuleManipulationUtilsKt
  - WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  - WARNING: All illegal access operations will be denied in a future release
- Coping extension assets
- Reading AndroidManifest.xml
x JSONArray[0] not found.

1 Like

Could you please let me know which version of FAST you are using? Additionally, could you share the logs.txt file that is located in the installed directory of FAST?

1 Like

Fast version

  __           _   
 / _| __ _ ___| |_ 
| |_ / _` / __| __|
|  _| (_| \__ \ |_ 
|_|  \__,_|___/\__| (v1.2.6)
Fast is initialized.
The installed fast version is: 1.2.6 11.11.24.21.56
fast build initialized.
PROJECT_DIR: /Users/husnain/testexten
Got the JAVA_HOME by system property.
JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
Got FAST_HOME from environment variable.
FAST_HOME: /Users/husnain/.local/share/Fast
KOTLIN_HOME: /Users/husnain/.local/share/Fast/lib/kotlinc
fast.yml is found at: /Users/husnain/testexten/fast.yml
AndroidManifest.xml is found at: /Users/husnain/testexten/src/AndroidManifest.xml
Package name is: com.testfast.testexten
Cleaning build caches.
Checking the availablity of .kt files.
Checking the availablity of .java file.
Getting provided libraries.
Got 85 libraries.
Getting the libraries of deps folder.
Got 55 libraries.
Adding kotlin libraies.
Increasing components version.
Compiling kotlin classes.
Running kotlinc
Successfully created kotlinc arguments
Calling kotlinc commands.
kotlinc is successfully executed.
Compiling java classes with kotlin sources as classpath.
Compiling java classes.
Found 1 sources.
Added custom bootclasspath to target Java 8.
Successfully created javac arguments
Calling javac commands.
Note: Wrote file file:///Users/husnain/testexten/.fast/classes/simple_components.json
Note: Wrote file file:///Users/husnain/testexten/.fast/classes/simple_components.txt
Note: Wrote file file:///Users/husnain/testexten/.fast/classes/simple_components_build_info.json
Note: Wrote file file:///Users/husnain/testexten/.fast/classes/AutogeneratedOdeMessages.java
Note: Wrote file file:///Users/husnain/testexten/.fast/classes/ComponentsTranslation.java
javac is successfully executed.
Running kapt compiler.
Successfully created kapt arguments
Calling kapt commands.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.kapt3.util.ModuleManipulationUtilsKt (file:/Users/husnain/.local/share/Fast/lib/kotlinc/lib/kotlin-annotation-processing.jar) to constructor com.sun.tools.javac.util.Context()
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.kapt3.util.ModuleManipulationUtilsKt
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
info: note: Wrote file file:///Users/husnain/testexten/.fast/kapt/simple_components.json
info: note: Wrote file file:///Users/husnain/testexten/.fast/kapt/simple_components.txt
info: note: Wrote file file:///Users/husnain/testexten/.fast/kapt/simple_components_build_info.json
info: note: Wrote file file:///Users/husnain/testexten/.fast/kapt/AutogeneratedOdeMessages.java
info: note: Wrote file file:///Users/husnain/testexten/.fast/kapt/ComponentsTranslation.java
kapt is successfully executed.
Making raw files.
Coping assets.
Reading AndroidManifest.xml
com.jewel.fast.repacked.hscrWKTXXUrLRGhDZujG: JSONArray[0] not found.
com.jewel.fast.repacked.hscrWKTXXUrLRGhDZujG: JSONArray[0] not found.
	at com.jewel.fast.repacked.OMwYeUAfbaBRzMtFyhgP.iUIKuJlLwsOpwhRkqGDF(Unknown Source)
	at com.jewel.fast.repacked.OMwYeUAfbaBRzMtFyhgP.iUIKuJlLwsOpwhRkqGDF(Unknown Source)
	at com.jewel.fast.repacked.OggnIzhFqrXyvGpcPouW.<init>(Unknown Source)
	at com.jewel.fast.repacked.qXSHrxLAZKiREPbpxhEi.<init>(Unknown Source)
	at com.jewel.fast.Fast.main(Unknown Source)


1 Like

Are you also getting the same error when trying to build a test project?

1 Like

No at first it was building successfully. Then I added a java file and kotlin helper file. Now getting this error.

2 Likes

Would you be able to provide a demo project so that I can investigate further to address this type of issue?

1 Like

It looks like r8 or proguard is removing information from the class file that Kawa needs to perform its compilation passes. What does the full proguard config look like?

3 Likes

:mega: An update is available v1.2.7

Date built: 12.11.24.21.50


  • Fixed warnings for kapt-compiler when using JDK11
1 Like

I also noticed that if I don't add a description for a function or property, I get warnings during compilation. Everything is fine, but why do I have 4 warnings for the same function? That is, I don't have a description in one function and I get 4 of the same warnings.

2 Likes

Thanks for letting me know about that. I'll make sure to fix it in the next update.

1 Like

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