How to use jess in Android - android

I'm trying to use JESS in and Android project. I tried using Jess 6 which is working fine on a web application on netbeans, but it's giving errors. It seems like the version of the jar file is not compatible.
I need help on how to integrate jess with an Android project.
The error is generated from a line of code:
Rete engine = new Rete();
See the error trail below:
2593-2593/com.example.modupe.tryjessapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.modupe.tryjessapp, PID: 2593
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/applet/Applet;
at jess.Rete.getApplet(Unknown Source)
at jess.Batch.batch(Unknown Source)
at jess.Rete.if(Unknown Source)
at jess.Rete.<init>(Unknown Source)
at jess.Rete.<init>(Unknown Source)
at jess.Rete.<init>(Unknown Source)
at com.example.modupe.tryjessapp.MainActivity.<init>(MainActivity.java:17)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.applet.Applet" on path: DexPathList[[zip file "/data/app/com.example.modupe.tryjessapp-1/base.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.modupe.tryjessapp-1/lib/x86, /system/lib, /vendor/lib]]
....

Jess uses a number of Java APIs that are not supported on Dalvik, Applet being one, but more importantly, java.beans.Introspector. An android-capable version of Jess is available as an alpha build to source licensees only; it hasn't been released.

Related

Can't add .so file to Android Studio 3.5.3 using jniLibs

I'm trying to add a .so file to a new Android project. I'm using Android Studio 3.5.3. I've done what was recommended here and here ; so I created folders (jniLibs/arm64-v8a, etc) in src/main and added this to app/build.gradle:
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
I placed the libhl.so file in /app/src/main/jniLibs/arm64-v8a (yes, 64-bit should be ok). The project will compile just fine, but on execution it will show the following error in logcat:
02-17 10:25:31.719 3691-3691/com.example.bmdtest03 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bmdtest03, PID: 3691
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.bmdtest03-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.bmdtest03-2/lib/x86_64, /vendor/lib64, /system/lib64]]] couldn't find "libhl.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.example.bmdtest03.MainActivity.<clinit>(MainActivity.java:14)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Conclusion: the file is there, the source is updated in build.gradle, what am I missing?
You can manually generate the .so file with NDK . Then you can add the lib.so file in your jni folder.
Add the NDK path to your local.properties.
Refer this page : https://developer.android.com/studio/projects/gradle-external-native-builds
If its not works. You can create javah then you can access it.
Link to make javah : https://developer.android.com/training/articles/perf-jni

trouble using HERE Mobile SDK UI Kit

I am trying to implement new HERE Mobile SDK UI Kit for Android but with no luck.
did everything described in Quickstart text file inside uikit-android-release-1.0.0-78. During gradle compiling
there is no error only when application launched. Pasting logcat errors.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
......................................
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/DividerItemDecoration;
at com.here.msdkui.routing.WaypointList.init(WaypointList.java:48)
at com.here.msdkui.routing.WaypointList.<init>(WaypointList.java:35)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
......................................
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.DividerItemDecoration"
on path: DexPathList[[zip file "/data/app/com.testapp.nav-1/base.apk",
zip file "/data/app/com.testapp.nav-1/split_lib_dependencies_apk.apk",
zip file "/data/app/com.testapp.nav-1/split_lib_slice_0_apk.apk",
zip file "/data/app/com.testapp.nav-1/split_lib_slice_1_apk.apk",
..................................................................
zip file "/data/app/com.testapp.nav-1/split_lib_slice_9_apk.apk"],
nativeLibraryDirectories=[/data/app/com.testapp.nav-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClas
Did you include the android support library in your build?
Seems like you are missing it!

android debug apk crashing but release apk run successfully

While running apk from android studio via adb it is working/running properly. but when i am giving that debug apk to my client it is crashing. but when i am giving signed apk it is working fine.
The debug apk installed successfully but when it going to run then it get "class not found error".
09-19 20:05:12.065 29019-29019/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.volansys.homebridge, PID: 29019
java.lang.RuntimeException: Unable to instantiate application com.volansys.homebridge.HomeBridgeApplication: java.lang.ClassNotFoundException: Didn't find class "com.volansys.homebridge.HomeBridgeApplication" on path: DexPathList[[zip file "/data/app/com.volansys.homebridge-2/base.apk"],nativeLibraryDirectories=[/data/app/com.volansys.homebridge-2/lib/arm, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.volansys.homebridge.HomeBridgeApplication" on path: DexPathList[[zip file "/data/app/com.volansys.homebridge-2/base.apk"],nativeLibraryDirectories=[/data/app/com.volansys.homebridge-2/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newApplication(Instrumentation.java:1014)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376) 
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6123) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) 
i also changed the manifest file and gave the whole path to the application class like
android:name="package_name.HomeBridgeApplication"
When i going to ctrl+click on this class it can navigate to this class. it means path is proper so why i am getting class not found error ?
can anyone help me ?
Thanks in Advance.

NoClassDefFoundError when updating from mockito 2.9.0 to 2.10.0

I am getting the following error when updating from mockito 2.9.0 to 2.10.0:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/mockito/internal/invocation/realmethod/RealMethod;
at com.android.dx.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:43)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:35)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
at org.mockito.Mockito.mock(Mockito.java:1798)
at org.mockito.Mockito.mock(Mockito.java:1711)
at org.ligi.passandroid.TestApp$createKodein$1$2.invoke(TestApp.kt:28)
at org.ligi.passandroid.TestApp$createKodein$1$2.invoke(TestApp.kt:21)
at com.github.salomonbrys.kodein.bindings.ASingleton.getInstance(bindings.kt:71)
at com.github.salomonbrys.kodein.bindings.NoArgBinding$DefaultImpls.getInstance(Binding.kt:186)
at com.github.salomonbrys.kodein.bindings.ASingleton.getInstance(bindings.kt:65)
at com.github.salomonbrys.kodein.bindings.ASingleton.getInstance(bindings.kt:65)
at com.github.salomonbrys.kodein.internal.KodeinContainerImpl$_transformBinding$1.invoke(KodeinContainerImpl.kt:129)
at com.github.salomonbrys.kodein.KodeinContainer$providerOrNull$1.invoke(KodeinContainer.kt:63)
at com.github.salomonbrys.kodein.Kodein$DefaultImpls.Instance(Kodein.kt:396)
at com.github.salomonbrys.kodein.internal.KodeinImpl.Instance(KodeinImpl.kt:13)
at org.ligi.passandroid.App.onCreate(App.kt:68)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.support.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:382)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.mockito.internal.invocation.realmethod.RealMethod" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/org.ligi.passandroid.test-1/base.apk", zip file "/data/app/org.ligi.passandroid-1/base.apk"],nativeLibraryDirectories=[/data/app/org.ligi.passandroid.test-1/lib/x86, /data/app/org.ligi.passandroid-1/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Anyone else getting this? Happening on an android project
Try using mockito-android instead of DexMaker (which doesn't seem to be working anymore for Android instrumentation tests on Mockito 2.10 and higher):
compile "org.mockito:mockito-android:2.11.0"

After updating Android Studio to 2.3 , my app works fine in device ( Nexus 5X) but it crash every time when i install the apk explicitly

I did these things:
1) Clean the code and remove everything in /build folder.
2) Analyse AndroidManifest.xml file all activities have proper package name as suffix
Multidex is already enabled
These are the Error Logs i got every time.:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.packagename, PID: 25752
java.lang.RuntimeException: Unable to instantiate application
com.android.packagename.BaseApplication:
java.lang.ClassNotFoundException: Didn't find class
"com.android.packagename.BaseApplication" on path: DexPathList[[zip
file
"/data/app/com.android.packagename-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.packagename-1/lib/arm64,
/system/lib64, /vendor/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5377)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.android.packagename.BaseApplication" on path: DexPathList[[zip
file
"/data/app/com.android.packagename-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.packagename-1/lib/arm64,
/system/lib64, /vendor/lib64]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at
android.app.Instrumentation.newApplication(Instrumentation.java:992)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5377)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Ok try to install instant run for your target api
Or disable instant run from Android studio
More about instant run
Preferences->Build,Execution,Deployment->instant Run
then,
function

Categories

Resources