Class not found exception

R Russell Mazonde 3 years 6 months ago
40 3 0

Hello Guys,
I am developing an android app for a Symbol TC70 device. I am looking to add EMDK methods to an activity class but on running the application I get the following error:
03-29 10:59:51.926 9666-9666/com.XXX.scanner_v2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.XXX.scanner_v2, PID: 9666
java.lang.NoClassDefFoundError: com/XXX/scanner_v2/ItemInfo
at com.XXX.scanner_v2.MainActivity$1.onClick(MainActivity.java:34)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18439)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5034)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:222)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:215)
at dalvik.system.DexPathList.findClass(DexPathList.java:322)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at com.XXX.scanner_v2.MainActivity$1.onClick(MainActivity.java:34) 
at android.view.View.performClick(View.java:4438) 
at android.view.View$PerformClick.run(View.java:18439) 
at android.os.Handler.handleCallback(Handler.java:733) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5034) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 
at dalvik.system.NativeStart.main(Native Method) 
My build Gradle dependencies are as follows:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation fileTree(dir: 'C:\\Program Files (x86)\\Symbol EMDK for Android\\v4.0\\Integrator\\add-ons\\addon-symbol-emdk_v4.0_API-19\\libs', include: ['*.aar', '*.jar'], exclude: [])
}
CAn you assist?

Please Register or Login to post a reply

3 Replies

R Russell Mazonde

I just required the following in my build.gradle under dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'], exclude: ['com.symbol.emdk.jar'])
provided files('C:/Program Files (x86)/Symbol EMDK for Android/v4.2/Integrator/add-ons/addon-symbol-emdk_v4.2-API-19/libs/com.symbol.emdk.jar')

D Darryn Campbell

The TC70 is quite an old device - back then you sometimes needed to deploy the EMDK runtime to the device.  See the EMDK readme for details, e.g. page 3 of https://www.zebra.com/content/dam/zebra_new_ia/en-us/software/developer…; I can't remember when this 'distribution' package was removed from EMDK but all the old EMDK versions are available for download.
 

R Russell Mazonde

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.CompoundButton;
import com.symbol.emdk.EMDKManager;
import com.symbol.emdk.barcode.BarcodeManager;
import com.symbol.emdk.barcode.ScanDataCollection;
import com.symbol.emdk.barcode.Scanner;
import com.symbol.emdk.barcode.ScannerInfo;
import com.symbol.emdk.barcode.StatusData;
public class ItemInfo extends AppCompatActivity implements EMDKManager.EMDKListener, Scanner.DataListener, Scanner.StatusListener, BarcodeManager.ScannerConnectionListener, CompoundButton.OnCheckedChangeListener{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_info);
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
@Override
public void onOpened(EMDKManager emdkManager) {
}
@Override
public void onClosed() {
}
@Override
public void onConnectionChange(ScannerInfo scannerInfo, BarcodeManager.ConnectionState connectionState) {
}
@Override
public void onData(ScanDataCollection scanDataCollection) {
}
@Override
public void onStatus(StatusData statusData) {
}
}

CONTACT
Can’t find what you’re looking for?