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

@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

ur right

for now this is the error

C:\Users\GOD\appinventor-sources\appinventor\lib\android\tools>java -jar dx.jar --dex C:\Users\GOD\appinventor-sources\appinventor\lib\nexcube\nexcube.jar
Picked up _JAVA_OPTIONS: -Xmx1024m

PARSE ERROR:
class name (cs/min2phase/CoordCube) does not match path (CoordCube.class)
...while parsing CoordCube.class
1 error; aborting

it says the error for the first java code file (i have 4 code file error coressponds to 1 of it) the file name is CoordCube the code file package name was

package cs.min2phase;

and the structure of the code will be

package cs.min2phase;

class CoordCube {
//code here i din't post code if required i will PM
}

so what should i do now

The error indicates that you didn't package the jar correctly. The class files should be in subdirectories corresponding to their package.

u mean the 4 class file

In folder asdfg I have 4 class file as u said to place in folder manner I placed
Asdfg\a\s\d\my 4 class file
So what is command I need to put in cmd

Thanks a lot compiled

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.