java.lang.NoClassDefFoundError: Failed resolution of: Lcs/min2phase/Search; what does it means

Can you show the annotation?

what do u mean by

you mean code of build xml

annoations like @SimpleFunction, @Nullable @ColorInt like this

1 Like

@Techno_Vedang is correct. This also happens with me . you have to move your imported classes in same folder (where is your extension class)

2 Likes

The extension build system only copies class files in the same package (plus any subpackages) of the extension. Because you're using Java files in a separate package, they won't be picked up by the extension system. The easiest thing to do would be to compile the dependency Java files to get the class files and put them into a JAR file (using the zip or jar utilities) and then place that in lib and make use of the library functionality built into the extension system since it knows how to pick up JAR libraries via the @UsesLibraries annotation.

3 Likes

@ewpatton really the same i did
now it compiled and in companion it worked :star_struck:

but

when i compile the apk

app inventor error log

kodular error log

Kodular is unable to compile this project.
The compiler error output was
________Preparing application icon
________Creating animation xml
________Creating fragment xml
________Creating listview xml in res/layout/..
________Creating listview xml in res/layout-v21/..
________Creating xml in res/drawable/..
________Creating splash png in res/drawable/..
________Creating colors xml
________Creating styles xml
________Creating drawables xml v21
________Checking for firebase
________Creating provider_path xml
________Creating network_security_config xml
________Generating adaptive icon file
________Generating round adaptive icon file
________Generating adaptive icon background file
________Generating manifest file
________Attaching native libraries
________Attaching Android Archive (AAR) libraries
________Attaching component assets
________Invoking AAPT
AAPT time: 1.23 seconds
________Compiling source files
(compiling io/kodular/electrobot999/nexcube/Screen1.yail to io.kodular.electrobot999.nexcube.Screen1)
(compiling /tmp/runtime8397583071109955809.scm to com.google.youngandroid.runtime)
Kawa compile time: 4.064 seconds
________Invoking DX
DX time: 4.319 seconds
________Invoking ApkBuilder
com.android.sdklib.build.ApkCreationException: Failed to add /tmp/1613547908514_0.8815810980618682-0/youngandroidproject/../build/tmp/classes3.dex
YAIL compiler - ApkBuilder failed.
.

:sob:

is it because of old compiler in app inventor or dx won't compile is there any way

Show all the annotations you're using.

@UsesLibraries(libraries = "nexcube.jar")

@DesignerComponent(version = 1, description = "this extension is used to make cube solving easy made by
" +"hifi apps. contact here-
website
",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "https://i.ibb.co/pnVG9xf/picture.png")

@SimpleObject(external = true)
public class nexcube extends AndroidNonvisibleComponent {
//search

private ComponentContainer container;
private Context context;
/**
 * @param container container, component will be placed in.
 */

public nexcube (ComponentContainer container) {
super(container.$form());
this.container = container;
this.context = container.$context();
}

@SimpleFunction(description = ""){
public String a(String b){
//a code for cube its secret i cant show this
}

You may want to try invoking dx.jar directly on your extension's libraries to see if it outputs any errors. In App Inventor we use multidex and so in theory it should split up the code into more classes.dex files to accommodate larger libraries, but it could be an issue with how you compiled the library sources.

please remember the naming conventions

Taifun

3 Likes

What you mean by this I can't understand what should I do now

where is it where should i put

dx.jar is found in lib/android/tools/. You run it like so:

java -jar lib/android/tools/dx.jar [options]

So if you do:

java -jar lib/android/tools/dx.jar --dex --output classes.dex path/to/your/classes path/to/your/libs

then you can see whatever errors dex generates for your extension.

If that doesn't yield any errors, consider running App Inventor locally using the dev server along with a local build server. You should be able to look at the raw console output to see if there are any other issues reported.

What is my classes,

you mean this as the .jar lib i imported

initially i had 4 java code file need to be imported but as i need to import a jar file i first converted the 4 java file to 4 class file using

javac *.java

then to convert the 4 class file to jar i used

jar cf JarExample.jar *.class

u mean the 4 class files

You can also just give the jar file since dex will read all class files from within it.

C:\Users\GOD\appinventor-sources\appinventor\lib\android\tools>java - jar dx.jar --dex C:\Users\GOD\appinventor-sources\appinventor\lib\nexcube\nexcube.jar
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

You didn't run the command properly. If you look at my post you can note that there is not a space between the - and jar.

1 Like