MultiDex NoClassDefFound error
Your AppWrapper class fails to load because the retrofit.ErrorHandler interface is not included in main dex file.
How do you calculate which classes to put in your main-dex-list file?
There's a script that can generate it for you. I wrote a blogpost that shows how to use it.
Update (10/31/2014):
Gradle plugin v0.14.0 now does it automatically. See my answer here.
Update (24/04/2017):
The developer guide explains how to pick specific classes with a gradle option if it doesn't pick all the right ones automatically.
MultiDex cause java.lang.NoClassDefFoundError in Android 4.4
Try adding the following rules in your proguard file:-
SSHd requires mina, and mina uses reflection so some classes would get deleted
-keep class org.apache.mina.** {*;}
-keep class org.apache.sshd.** {*;}
-dontwarn org.apache.sshd.**
-dontwarn org.apache.mina.**
Also check your gradle file for these two dependencies:-
implementation 'org.apache.sshd:sshd-core:0.14.0'
implementation 'org.apache.mina:mina-core:2.0.19'
Android MultiDex ClassNotFoundException
@razzledazzle: Thanks a lot. These tips are very helpful.
After that, I´ve the next problems. In my apk-file missing classes respectively classdefinitions. SOME sugarmodels-classes was missing (NOT ALL). The little tool classyshark and the sugarlog help me!
So I compare the classes and found a solution!
For all Sugar-ORM-Users with multiDex problems. I put the "ignore"-Annotation for a debugvariable in all my sugarclasses and now they are in the dexfile.
I don´t know how or why, but it works...
@Ignore
public boolean multiDex;
Maybe there is better solution, but I don´t know... Possibly the RetentionPolicy
of the Ignore-annotation do the trick.
Next thing for possible Sugar-Orm problems could be the proguardtool. It is important to keep the classnames of your models.
-keep class com.package.example.models.* {*;}
these rule keep the complete class for proguard. I hope it help.
Happy coding...
MultiDex issue: java.lang.ClassNotFoundException: Didn't find class on path: DexPathList
So last but not least my answer:
All my configuration for multidex was correct... I don't know why, but after a complete OS restart everything works fine now... :)
Adding MultiDex to a project in android studio but keeping getting java.lang.NoClassDefFoundError
You want to create a Base class that extends the MultiDex if you don't have one.
public class BaseApp extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
}
}
Your Manifest can look like below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.finalyearprojectapp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".BaseApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainScreen" />
<activity android:name=".RegisterActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Edit:
You should upgrade your firebase to the latest, or at least version from 17.0.0 and above.
I was told that According to firebase release notes May 07, 2019, it says; "If you use Firebase Authentication, update to firebase-auth v17.0.0 or later to ensure functionality alignment with other updated Firebase libraries."
Multidex throws java.lang.NoClassDefFoundError, RxJava, Retrolambda
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
Related Topics
Multiple Commands Through Jsch Shell
Connectiontimeout Versus Sockettimeout
How to Transform Currenttimemillis to a Readable Date Format
Setting Android Images from String Value
How to Exclude an Element from a Firestore Query
Getlocationonscreen() VS Getlocationinwindow()
Android - How to Change Fragments in the Navigation Drawer
Broadcastreceiver for Action_Media_Button Not Working
How to Declare on UI Component in Android with Kotlin
Rselenium Unknownerror - Java.Lang.Illegalstateexception with Google Chrome
How to Get from Jruby a Correctly Typed Ruby Implementation of a Java Interface
How to Overcome an HTMLunit Scriptexception
Does a Method's Signature in Java Include Its Return Type
"Invalid Privatekey" When Using Jsch
Environment Variables in Eclipse
How to Resume Android Activity Programmatically from Background