Rush β€’ A new and improved way of building extensions

jdk1.8.0_202 - installed openJDK8 and also Oracle JDK 8, not both at same time.

but no JAVAC version,

Does rush support native libraries? Searching this topic it seems that it does but I run into issues when I try to include a library that uses a native library. I'm trying to build an app that retrives information from a Pi Hole server on my home network but I don't want it to even attempt connecting to it unless on the home wifi. To do that I was trying to get the gateway MAC address and if it matched the one of my home network then I would get information from the Pi Hole. Using the Taifun Wifi extension I can get the gateway IP address but not it's MAC address. I then use the KIO4 Terminal extension to run ip neigh which prints the IP addresses and their Mac addresses. Unfortunately ip neigh doesn't work on android sdk 30 or 31 which is a requirement I have (the phone I was wanting to use it on is sdk 31). I then found this library that uses a native library to bypass that restriction on sdk 30 and 31. I then looked on the jitpack build log and found the URL of the build artifact. I then use a app inventor simple function to wrap the library. When I call it I get an error about not being able to find the custom native library in the location of system native libraries. The .so is stored in the .aar in jni/{arch}/libipneigh-android.so for each respective archetecture. The library calls System.loadLibrary("ipneigh-android") on class initialization so that ArpNDK.getARP() works properly. I don't know if this is an issue with how rush handles native libraries, the library is packaged, or how libipneigh-android.so is loaded. I don't know much about how android java natives work and am very lost. Can anyone help?

P.S. I found this but it isn't helpful.

I did some looking and found the .so buried in the AndroidRuntime.jar so it looks like it's at least included somewhere in the extension. I'll have to do some more looking into why I'm having issues with it (e.g. building it directly, clearing the cache on the companion, checking logcat, etc.)

When I run it through do it then I get an error about
something DEX related. When I run it at a button press in the compiled app I get Runtime Error com.errinvalidname.ipneighsdk30.repack.h. I'll check logcat and see if it has anymore detail when I get home.

Currently it's not possible to package an extension with native libraries. You can only add native libraries if you're using offline builder of Mit App Inventor 2.

Okay, thank you

I don't think so.

λ‚˜λ„ λ˜‘κ°™μ€ λ¬Έμ œκ°€ μžˆμ—ˆλ‹€.
κ·Έ μ΄μœ λŠ” jdk ν”„λ‘œκ·Έλž¨μ΄ μ„€μΉ˜λ˜μ–΄ μžˆμ§€ μ•Šμ•˜κΈ° λ•Œλ¬Έμ΄λ‹€
그리고
μœˆλ„μš°μ¦ˆ ν™˜κ²½λ³€μˆ˜μ—μ„œ jdk ν”„λ‘œκ·Έλž¨μ΄ μ„€μΉ˜λ˜μ–΄ μžˆλŠ” pathλ₯Ό μ„€μ •ν•΄μ€˜μ•Ό ν•œλ‹€.

  1. cmdμ—μ„œ java -version 이 μ‹€ν–‰λ˜λŠ”μ§€ 확인

  2. cmdμ—μ„œ javac -version 이 μ‹€ν–‰λ˜λŠ”μ§€ 확인
    image

  3. javac κ°€ μ‹€ν–‰λ˜μ§€ μ•ŠμœΌλ©΄ jdk install

  4. μœˆλ„μš°μ¦ˆ ν™˜κ²½λ³€μˆ˜μ—μ„œ jdk ν”„λ‘œκ·Έλž¨ path μ„€μ •

I couldn't get it to work on Linux Mint

Where do you have a problem ?

1 Like
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

β€’ Build initialized

β”Œ Checking project files
β”‚ info Checking metadata file (rush.yml)
β”‚ info Checking AndroidManifest.xml file
β”” done
β”Œ Compiling sources
β”‚ info Picked 1 source file
β”” done
β”Œ Processing the extension
β”‚ info Linking extension assets
β”‚ info Generating DEX bytecode
β”‚      Compilation failed with an internal error.
β”‚      java.lang.IllegalArgumentException: Unsupported class file major version 65
β”‚      	at com.android.tools.r8.A.a.a.f.<init>(:10)
β”‚      	at com.android.tools.r8.A.a.a.f.<init>(:2)
β”‚      	at com.android.tools.r8.A.a.a.f.<init>(:1)
β”‚      	at com.android.tools.r8.A.a.a.f.<init>(:107)
β”‚      	at com.android.tools.r8.graph.x0.a(:24)
β”‚      	at com.android.tools.r8.dex.a$a.a(:12)
β”‚      	at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1456)
β”‚      	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
β”‚      	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
β”‚      	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
β”‚      	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
β”‚      	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
β”” failed

β€’ Build failed [7s 75ms] []

This problem occurs even with the test file. I've already tried version 8 of the Java SDK and it didn't work.

Do you get the same error report with the default test file ?

Are you sure you have the Java 8 SDK installed correctly ? Rush needs Java Development Kit (JDK) 8 along with the JRE

rush -v
                      __
     _______  _______/ /_
    / ___/ / / / ___/ __ \
   / /  / /_/ (__  / / / /
  /_/   \__,_/____/_/ /_/

Version:   1.2.4
Built on:  2022-01-19 17:22:30

javac -version
javac 1.8.0_392
1 Like

Ok, im new on this, so:

  • I want [i need learn java first] to create a extension to mannage Supabase conections, Auth, etc.
    this means that i can no use the WEB component to do it, if i dont download all the AppInventor project first???

Looks like your code is being compiled using JDK 21. You need JDK 8 to build extensions. Try running javac -version to see which version you're on.

Also, try clearing the .rush/build directory if switching to JDK 8 doesn't work.

2 Likes

The problem was that java was at version 1.8 and javac at a higher version. Now it's working!

Screenshot 2024-03-28 005700

All okay?

image

Probably not...

The problem was that java was at version 1.8 and javac at a higher version. Now it's working!

You need the same version for javac too ! You need this version in the goal that it works ! Believe me I have followed the kio4 tutorial from Juan and it works perfectly !

1 Like

Your environment variable order is wrong.

You only need JDK 1.8. It is added correctly, but you have also added JDK 11 path and other path before which receive high priority.

Follow these steps to well configure java here : Extensions App inventor 2 Create Extensions Tutorial Build extensions tutorial easy.