I am getting a very strange error like java.lang.NoClassDefFoundError: com.example.Fragments.SecondarySplashFragment while running my application with buildToolsVersion '23.0.1' in Android Studio (Windows version). This error completely seems to be very weird and new to me since I am facing this only with Windows version of Android studio, whereas it is working without any flaw in Ubuntu version. I really don't know what to do and completely stuck up with this error for the past two days. Any kind of solution would be much helpful for me. I am also posting my complete logcat below for your reference as follows.
java.lang.NoClassDefFoundError: com.example.Fragments.SecondarySplashFragment$1
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.example.Fragments.SecondarySplashFragment.findViews(SecondarySplashFragment.java:71)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.example.Fragments.SecondarySplashFragment.onCreateView(SecondarySplashFragment.java:59)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.Fragment.performCreateView(Fragment.java:1965)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1078)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1259)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1624)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1177)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.Activity.performStart(Activity.java:5461)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:175)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.os.Looper.loop(Looper.java:146)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5602)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile files('libs/volley.jar')
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
Note: This issue is happening only with buildToolsVersion 23.0.1 but however if I change it to buildToolsVersion 22.2.0 everything works fine without any issues.
Thanks in advance.
Related
I am developing Android App for API level 16 & above:
minSdkVersion 16, targetSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Dependencies:
implementation "com.github.bumptech.glide:glide:4.11.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
implementation "com.github.bumptech.glide:okhttp3-integration:4.11.0"
I am using Glide & as per this requirement it should work for (API level 14) or higher. OkHttp exception “Expected Android API level 21+ but was 29” is also fixed in 3.14.7. When I compile app it crashes with following Logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202)
at retrofit2.Retrofit$Builder.build(Retrofit.java:614)
at com.example.retrofitgliderecycler.MoviesRepository.getInstance(MoviesRepository.java:33)
at com.example.retrofitgliderecycler.MainActivity.onCreate(MainActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.VerifyError: okhttp3/internal/platform/Android10Platform
at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:202)
at retrofit2.Retrofit$Builder.build(Retrofit.java:614)
at com.example.retrofitgliderecycler.MoviesRepository.getInstance(MoviesRepository.java:33)
at com.example.retrofitgliderecycler.MainActivity.onCreate(MainActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
You might wanna open an issue on okHttp as you're getting Caused by: java.lang.VerifyError: okhttp3/internal/platform/Android10Platform which seems to be the package fault, there is the same issue here
I decided to create test example:
multidex true (1.0.1), rxjava 2.1.0, retrolambda 3.6.0
So I see bug on Android 4-6
Android 4
06-20 21:13:05.736 4123-4123/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: example.com.multidexandroid6rxjava.MainActivity$$Lambda$1
at example.com.multidexandroid6rxjava.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Android 5.1.1
FATAL EXCEPTION: main
Process: example.com.multidexandroid6rxjava, PID: 3729
java.lang.NoClassDefFoundError: Failed resolution of: Lexample/com/multidexandroid6rxjava/MainActivity$$Lambda$1;
at example.com.multidexandroid6rxjava.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.ClassNotFoundException: Didn't find class "example.com.multidexandroid6rxjava.MainActivity$$Lambda$1" on path: DexPathList[[zip file "/data/app/example.com.multidexandroid6rxjava-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
Simple example
Please try the following code.
It worked on Android 6.
before
protected <T> void connectObservableField(#NonNull T observableField, #Nullable java.util.function.Consumer<? super T> consumer) {
after
protected <T> void connectObservableField(#NonNull T observableField, #Nullable io.reactivex.functions.Consumer<? super T> consumer) {
java.util.function.* seems not to work with retrolambda.
So you try to use io.reactivex.functions.Consumer instead.
See also https://github.com/orfjackal/retrolambda/issues/126#issuecomment-289307387
i am having a problem dealing with this error, when i run my app it stops and shows error in logcat:
Caused by: java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.os.BuildCompat" on path: DexPathList[[zip file
"/data/app/homeseek.app.android.capstonehomeseek-2/base.apk"],nativeLibraryDirectories=[/data/app/homeseek.app.android.capstonehomeseek-2/lib/arm64,
/vendor/lib64, /system/lib64]]
full error:
FATAL EXCEPTION: main 11-29 13:00:24.538 1919-1919/? E/AndroidRuntime:
Process: homeseek.app.android.capstonehomeseek, PID: 1919 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime:
java.lang.NoClassDefFoundError: Failed resolution of:
Landroid/support/v4/os/BuildCompat; 11-29 13:00:24.538 1919-1919/?
E/AndroidRuntime: at
android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:188)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
homeseek.app.android.capstonehomeseek.MainActivity.onCreate(MainActivity.java:48)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.Activity.performCreate(Activity.java:6323) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.access$900(ActivityThread.java:153) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.os.Handler.dispatchMessage(Handler.java:102) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.os.Looper.loop(Looper.java:148) 11-29 13:00:24.538 1919-1919/?
E/AndroidRuntime: at
android.app.ActivityThread.main(ActivityThread.java:5451) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.reflect.Method.invoke(Native Method) 11-29 13:00:24.538
1919-1919/? E/AndroidRuntime: at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: Caused by:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.os.BuildCompat" on path: DexPathList[[zip file
"/data/app/homeseek.app.android.capstonehomeseek-1/base.apk"],nativeLibraryDirectories=[/data/app/homeseek.app.android.capstonehomeseek-1/lib/arm64,
/vendor/lib64, /system/lib64]] 11-29 13:00:24.538 1919-1919/?
E/AndroidRuntime: at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.ClassLoader.loadClass(ClassLoader.java:511) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.ClassLoader.loadClass(ClassLoader.java:469) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:188)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
homeseek.app.android.capstonehomeseek.MainActivity.onCreate(MainActivity.java:48)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.Activity.performCreate(Activity.java:6323) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.access$900(ActivityThread.java:153) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.os.Handler.dispatchMessage(Handler.java:102) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
android.os.Looper.loop(Looper.java:148) 11-29 13:00:24.538
1919-1919/? E/AndroidRuntime: at
android.app.ActivityThread.main(ActivityThread.java:5451) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.reflect.Method.invoke(Native Method) 11-29 13:00:24.538
1919-1919/? E/AndroidRuntime: at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: Suppressed:
java.lang.ClassNotFoundException: android.support.v4.os.BuildCompat
11-29 13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.Class.classForName(Native Method) 11-29 13:00:24.538
1919-1919/? E/AndroidRuntime: at
java.lang.BootClassLoader.findClass(ClassLoader.java:781) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: at
java.lang.ClassLoader.loadClass(ClassLoader.java:504) 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: ... 18 more 11-29
13:00:24.538 1919-1919/? E/AndroidRuntime: Caused by:
java.lang.NoClassDefFoundError: Class not found using the boot class
loader; no stack trace available
here's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "homeseek.app.android.capstonehomeseek"
minSdkVersion 20
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/PhotoUtil.jar')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile ('com.android.support:support-v4:23.4.0'){
force = true;
}
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
i really have no idea how to fix this please help me
I faced with this proplem .And I think problem is :
compile 'com.google.android.gms:play-services:9.8.0'
You complile with may packages .In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit . So this make NoClassDefFoundError .
Follow this my post: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap
I'm a new user of this forum, and I have a little problem:
I'm trying to make an android app, which has to use the ZBar libs, and I've founded something on the web.
So, I've written my code, but when I try to execute it on the emulator (I use Android Studio 1.5.1), I receive the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.mirco.myapplication.BarcodeScanner.initControls(BarcodeScanner.java:50)
at com.example.mirco.myapplication.BarcodeScanner.onCreate(BarcodeScanner.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 793 could not load needed library 'libiconv.so' for 'libzbarjni.so' (load_library[1093]: Library 'libiconv.so' not found)
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at net.sourceforge.zbar.ImageScanner.<clinit>(Unknown Source)
at com.example.mirco.myapplication.BarcodeScanner.initControls(BarcodeScanner.java:50)
at com.example.mirco.myapplication.BarcodeScanner.onCreate(BarcodeScanner.java:40)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
My dependencies:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/zbar.jar') }
I am using ZBar SDK 0.1
I updated by gradle to API 23 as well as the dependencies but when I tried running my app I get a NoClassDefFoundError:
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: FATAL EXCEPTION: main
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: Process: com.aufmschoolbliz.app, PID: 11323
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: java.lang.NoClassDefFoundError: android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23$1
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.Class.classForName(Native Method)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.Class.forName(Class.java:309)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.ReflectionUtils.getModelClasses(ReflectionUtils.java:83)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.DatabaseHelper.onCreate(DatabaseHelper.java:46)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.Registry.openDatabase(Registry.java:149)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.Registry.initialize(Registry.java:107)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:8)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.activeandroid.app.Application.onCreate(Application.java:9)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.aufmschoolbliz.app.SchoolBliz.onCreate(SchoolBliz.java:42)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4553)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:151)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5254)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
10-11 01:26:30.794 11323-11323/com.aufmschoolbliz.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Grade file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 4
versionName "2.1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':numberPickerSupport')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
}
According to ianhanniballake, https://stackoverflow.com/a/32484445/2450000, it is because of the dependencies but I'm not using dynamic version number.
My dependencies is more clear
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile files('libs/activeandroid-3.0.jar')
Done!The following is what I done to solve this.
1. Change all of the AppCompatActivity into Activity.
2.
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:appcompat-v7:21.0.+'
Change v7 from 23.1.0 to 21.0.+
3. Change project compiler version from 6.0(API23) to 5.0(API21)
My application run with ActivieAndroid again