I am getting a NoClassDefFoundError only when I use a specific library along with the adobe aviary library.
Gradle and error are shown below Code seem to be working when I don't use that crop library. I really want to use that library as all of my code is configured according to it. Please give me a solution for this
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.jetslice.retroart1"
manifestPlaceholders = [appPackageName: "com.jetslice.retroart1"]
minSdkVersion 19
targetSdkVersion 26
renderscriptTargetApi 21
renderscriptSupportModeEnabled true
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
}
dexOptions {
javaMaxHeapSize "64k"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.clans:fab:1.6.4'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
compile 'com.adobe.creativesdk:image:4.8.4'
compile 'com.localytics.android:library:3.8.0'
compile 'com.adobe.creativesdk.foundation:assetux:0.9.1251'
compile 'com.adobe.creativesdk.foundation:assetcore:0.9.1251'
compile 'com.android.support:multidex:1.0.1'
compile 'com.ms.square:glassview:0.1.0'
compile 'com.android.support:support-v4:26.+'
compile 'com.jpeng:jpspringmenu:1.0.1'
compile 'com.github.mzelzoghbi:zgallery:0.3'
compile 'com.github.doctoror.particlesdrawable:library:1.0.8'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile 'hanks.xyz:htextview-library:0.1.5'
compile 'com.github.MorochoRochaDarwin:HorizontalScrollMenu:2.0.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
testCompile 'junit:junit:4.12'
}
Error:
02-19 18:55:48.042 25223-25223/com.jetslice.retroart1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.jetslice.retroart1, PID: 25223
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/AsyncTaskCompat;
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.loadTools(AdobeImageEditorActivityAbstract.java:760)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.onPostCreate(AdobeImageEditorActivityAbstract.java:579)
at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1195)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2542)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5740)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.os.AsyncTaskCompat" on path: DexPathList[[zip file "/data/app/com.jetslice.retroart1-1/base.apk"],nativeLibraryDirectories=[/data/app/com.jetslice.retroart1-1/lib/arm, /data/app/com.jetslice.retroart1-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.loadTools(AdobeImageEditorActivityAbstract.java:760)
at com.adobe.creativesdk.aviary.AdobeImageEditorActivityAbstract.onPostCreate(AdobeImageEditorActivityAbstract.java:579)
at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1195)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2542)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5740)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)
Suppressed: java.lang.ClassNotFoundException: android.support.v4.os.AsyncTaskCompat
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Related
I'm developing a face recognition application using android and openCV. My android studio version is 3.5.3 and openCV version is 3.4.10. The phone on which I'm running my application is arm64-v8a and I'm getting this error :
2020-04-15 15:00:40.425 15788-15788/com.example.opencvdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.opencvdemo, PID: 15788
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.example.opencvdemo-o8BNe1NoZik-avIk3otJaw==/lib/arm64/libjniopencv_contrib.so" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_contrib.<clinit>(opencv_contrib.java:97)
at com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(Native Method)
at com.example.opencvdemo.CtrRecognizer.<init>(CtrRecognizer.java:40)
at com.example.opencvdemo.MainActivity$1.onManagerConnected(MainActivity.java:94)
at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:319)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1956)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1988)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7520)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.example.opencvdemo-o8BNe1NoZik-avIk3otJaw==/lib/arm64/libopencv_contrib.so" is 32-bit instead of 64-bit
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:577)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_contrib.<clinit>(opencv_contrib.java:97)
at com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(Native Method)
at com.example.opencvdemo.CtrRecognizer.<init>(CtrRecognizer.java:40)
at com.example.opencvdemo.MainActivity$1.onManagerConnected(MainActivity.java:94)
at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:319)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1956)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1988)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7520)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
2020-04-15 15:00:40.427 15788-15788/com.example.opencvdemo E/MQSEventManagerDelegate: failed to get MQSService.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
//buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.opencvdemo"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jni.srcDirs = ['src/main/jniLibs']
jniLibs.srcDir 'src/main/libs'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.so'])
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.markushi:circlebutton:1.1'
implementation project(path: ':openCV3410')
}
For removing this error I made changes to my build.gradle as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
//buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.opencvdemo"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jni.srcDirs = ['src/main/jniLibs']
jniLibs.srcDir 'src/main/libs'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.so'])
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.markushi:circlebutton:1.1'
implementation project(path: ':openCV3410')
}
Now I'm getting this error :
2020-04-15 15:11:19.353 17892-17892/com.example.opencvdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.opencvdemo, PID: 17892
java.lang.UnsatisfiedLinkError: dlopen failed: library "../../lib/libopencv_core.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_contrib.<clinit>(opencv_contrib.java:97)
at com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(Native Method)
at com.example.opencvdemo.CtrRecognizer.<init>(CtrRecognizer.java:40)
at com.example.opencvdemo.MainActivity$1.onManagerConnected(MainActivity.java:94)
at com.example.opencvdemo.MainActivity.onResume(MainActivity.java:233)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
at android.app.Activity.performResume(Activity.java:8050)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4236)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4278)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7520)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "../../lib/libopencv_core.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:577)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_contrib.<clinit>(opencv_contrib.java:97)
at com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(Native Method)
at com.example.opencvdemo.CtrRecognizer.<init>(CtrRecognizer.java:40)
at com.example.opencvdemo.MainActivity$1.onManagerConnected(MainActivity.java:94)
at com.example.opencvdemo.MainActivity.onResume(MainActivity.java:233)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1454)
at android.app.Activity.performResume(Activity.java:8050)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4236)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4278)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7520)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
2020-04-15 15:11:19.361 17892-17892/com.example.opencvdemo E/MQSEventManagerDelegate: failed to get MQSService.
According to the stack trace: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.example.opencvdemo-o8BNe1NoZik-avIk3otJaw==/lib/arm64/libjniopencv_contrib.so" is 32-bit instead of 64-bit
So I suppose that your library doesn't have resources for arm64-v8a, to solve this problem you must add to your project opencv .so files for arm64-v8a arch
Follow these steps if you are getting .so file not found in jniLibs folder
1- add source path in android in buildgradle file below defaultConfig
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
2- add ndk in defaultConfig in buildgradle file. abifilters can be found in jniLibs folders containing missing files.
ndk{
abiFilters 'armeabi-v7a'
}
if not resolved then visit this link https://blog.csdn.net/u010920692/article/details/114476490
Recently, I change the Android project from targetSdkVersion 26 to 28. I got crash report from Google Play with "java.lang.ClassNotFoundException" error
java.lang.NoClassDefFoundError:
at com.google.android.vending.licensing.ServerManagedPolicy.decodeExtras (ServerManagedPolicy.java:266)
at com.google.android.vending.licensing.ServerManagedPolicy.processServerResponse (ServerManagedPolicy.java:113)
at com.google.android.vending.licensing.LicenseValidator.handleResponse (LicenseValidator.java:206)
at com.google.android.vending.licensing.LicenseValidator.verify (LicenseValidator.java:166)
at com.google.android.vending.licensing.LicenseChecker$ResultListener$2.run (LicenseChecker.java:242)
at android.os.Handler.handleCallback (Handler.java:873)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:214)
at android.os.HandlerThread.run (HandlerThread.java:65)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
at com.google.android.vending.licensing.ServerManagedPolicy.decodeExtras (ServerManagedPolicy.java:266)
at com.google.android.vending.licensing.ServerManagedPolicy.processServerResponse (ServerManagedPolicy.java:113)
at com.google.android.vending.licensing.LicenseValidator.handleResponse (LicenseValidator.java:206
at com.google.android.vending.licensing.LicenseValidator.verify (LicenseValidator.java:166)
at com.google.android.vending.licensing.LicenseChecker$ResultListener$2.run (LicenseChecker.java:242)
at android.os.Handler.handleCallback (Handler.java:873)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:214)
at android.os.HandlerThread.run (HandlerThread.java:65)
I don't know what is going on. Any help will be appreciated
In gradle.build, multiDexEnabled has been added
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.myapptool"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.android.support:design:28.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/achartengine-1.2.0.jar')
compile project(':filemanager')
compile project(':moreapp')
compile files('libs/log4j-1.2.15.jar')
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:multidex:1.0.1'
}
This seems like multidex related problem. Please enable multidex in gradle.build
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
implementation 'com.android.support:multidex:1.0.0'
}
I'm building an Android application and facing a no static method exception when trying to read the XLSX files.
Tried all possibilities like updating dependencies in app/build.gradle, but no avail.
Kindly help me to resolve this issue.
Exception causing line in code: XSSFWorkbook myWorkBook = new XSSFWorkbook(fis);
08-07 12:37:05.828 16406-16511/droidmentor.tabwithviewpager E/AndroidRuntime:
FATAL EXCEPTION: AsyncTask #1
Process: droidmentor.tabwithviewpager, PID: 16406
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.NoSuchMethodError: No static method newFactory()Ljavax/xml/stream/XMLEventFactory; in class Ljavax/xml/stream/XMLEventFactory; or its super classes (declaration of 'javax.xml.stream.XMLEventFactory' appears in /data/app/droidmentor.tabwithviewpager-2/split_lib_dependencies_apk.apk)
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:45)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:87)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:254)
at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.readXLSX(ChatFragment.java:191)
at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.doInBackground(ChatFragment.java:112)
at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.doInBackground(ChatFragment.java:88)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
I'm adding app.gradle file. The other codes are basic XLSX file reading using XSSF. When I tried to run this java snippet in Spring Suite Tool, it runs properly. However, When I integrate those java snippets into the Android app, it causing this runtime exception.
App.Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "droidmentor.tabwithviewpager"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.0.0'
//noinspection GradleCompatible
compile 'com.android.support:design:25.0.+'
compile 'org.apache.poi:poi:3.10-FINAL'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.poi:poi:3.11-beta2'
compile 'org.apache.poi:poi-ooxml:3.11-beta2'
compile 'javax.inject:javax.inject:1'
compile 'javax.servlet:servlet-api:2.5'
compile 'javax.servlet.jsp:jsp-api:2.1'
compile 'javax.servlet:jstl:1.2'
compile 'junit:junit:4.7'
compile 'net.sf.opencsv:opencsv:2.3'
compile 'org.apache.poi:poi-ooxml:2.3'
compile 'org.apache.poi:poi-ooxml-schemas:3.8'
compile 'org.apache.xmlbeans:xmlbeans:2.3.0'
compile 'dom4j:dom4j:1.6.1'
}
Check if you are applying any obfuscation on your apk, if yes, you need to -keep those packages and classes so that they won't be stripped by proguard.
I don't know why my Google maps crashing , but when I put this dependency in my gradle it crashes :
compile 'com.google.android.gms:play-services-maps:10.2.0'
This is my Full Gradle Script :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
// generatedDensities = []
applicationId "company.override.huzykamz.policecopuganda"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile 'com.google.maps.android:android-maps-utils:0.5+'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.koushikdutta.ion:ion:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
}
This is the Error am getting :
Process: company.override.huzykamz.policecopuganda, PID: 11016
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;)V in class Lcom/google/android/gms/common/internal/zzaj; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaj' appears in /data/app/company.override.huzykamz.policecopuganda-2/split_lib_dependencies_apk.apk:classes49.dex)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1801)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1776)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5427)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5000)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4940)
at android.app.ActivityThread.access$1600(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
I am Using docx4j to read Docx file from sd card. I have problem with org.apache.log4j.Logger library. I have even tried to add it externally. but it is still giving me same problem.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.shvet.pdfreaders"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:23.1.1'
// compile('org.docx4j:docx4j:2.8.0') {
// transitive = false
// }
compile 'org.apache.logging.log4j:log4j-core:2.5'
compile files('libs/docx4j-2.8.0.jar')
}
Logcat
02-16 16:15:48.025 24912-24912/com.shvet.pdfreaders E/AndroidRuntime:
FATAL EXCEPTION: main
Process: com.shvet.pdfreaders, PID: 24912
java.lang.NoClassDefFoundError: Failed resolution of:
Lorg/apache/log4j/Logger;
at org.docx4j.openpackaging.Base.(Base.java:42)
at
com.shvet.pdfreaders.fragments.PdfViewFragment$6.fileSelected(PdfViewFragment.java:205)
at
com.shvet.pdfreaders.extra.FileChooser$1.onItemClick(FileChooser.java:59)
at android.widget.AdapterView.performItemClick(AdapterView.java:305)
at android.widget.AbsListView.performItemClick(AbsListView.java:1146)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3057)
at android.widget.AbsListView$3.run(AbsListView.java:3864)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:139)
at android.app.ActivityThread.main(ActivityThread.java:5298)
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:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"org.apache.log4j.Logger" on path: DexPathList[[zip file
"/data/app/com.shvet.pdfreaders-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,
/system/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at org.docx4j.openpackaging.Base.(Base.java:42)
at
com.shvet.pdfreaders.fragments.PdfViewFragment$6.fileSelected(PdfViewFragment.java:205)
at
com.shvet.pdfreaders.extra.FileChooser$1.onItemClick(FileChooser.java:59)
at android.widget.AdapterView.performItemClick(AdapterView.java:305)
at android.widget.AbsListView.performItemClick(AbsListView.java:1146)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3057)
at android.widget.AbsListView$3.run(AbsListView.java:3864)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:139)
at android.app.ActivityThread.main(ActivityThread.java:5298)
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:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
Suppressed: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 16 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the
boot class loader; no stack available
What I have done till now: I tried with jar file and external log4j and used gradle url with and without log4j library.