Android Question [solved] Failed resolution of: Landroid/arch/lifecycle/ViewModelProviders

DonManfred

Expert
Licensed User
Longtime User
I am in the phase of Updating the Firebase UI Auth library with the newest Maven Artifacts and the newest Version of the Githubproject.

I updated all Artifacts, i updated the Firebase UI - Code from Github to the newest release (last updated about a month ago).
I realized that google has changed the way to add a Auth-Provider.
I needed to rewrite the wrapper to match the new Google-Rules resp. to match the new UI Library

After i came into different errors it is all done now.

But now, when i call the FirebaseUI to show the available Providerslist to select one from it crashes because of
NoClassDefFoundError: Failed resolution of: Landroid/arch/lifecycle/ViewModelProviders;
Logger verbunden mit: 988ad036525346515630
--------- beginning of crash
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
FBAuth_SignedIn
You are logged offf
** Activity (main) Pause, UserClosed = false **
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/lifecycle/ViewModelProviders;
at com.firebase.ui.auth.KickoffActivity.onCreate(KickoffActivity.java:32)
at android.app.Activity.performCreate(Activity.java:7174)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ViewModelProviders" on path: DexPathList[[zip file "/data/app/de.donmanfred.fbui-QjQ2LbCEDiSYCIiKUToRZA==/base.apk"],nativeLibraryDirectories=[/data/app/de.donmanfred.fbui-QjQ2LbCEDiSYCIiKUToRZA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 13 more

android/arch/lifecycle/ViewModelProviders is part of android.arch.lifecycle.viewmodel

I tried to get rid of them using
B4X:
#AdditionalJar: android.arch.lifecycle:viewmodel
but the error is the same

I copied the aar from the B4A SDK Managers b4a_remote Folder...
I tried to use
B4X:
#AdditionalJar: viewmodel-1.1.1.aar
But then i get a error when compiling.

B4A Version: 8.00
Parse den Code. (0.00s)
Kompiliere den Code. (0.20s)
Kompiliere Layoutcode. (0.00s)
Organisiere Libraries. (3.18s)
Generiere R Datei. (2.22s)
Kompiliere generierten Java Code. (2.03s)
Byte-Code konvertieren - optimiert dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/AndroidViewModel;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModel;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelProvider;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelProvider$AndroidViewModelFactory;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelProvider$Factory;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelProvider$NewInstanceFactory;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelStore;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/arch/lifecycle/ViewModelStoreOwner;
8 errors; aborting

No matter what i try it does not work...
If i remember correctly then i read something in the past (maybe from Erel; can´t remember) that these Lifecycle components are added at compilitime when using Android Studio.

I guess they are included in the AARs which i created with AS.
#AdditionalJar: firebase-ui-auth.aar ' Probably this one
#AdditionalJar: firebase-ui-common.aar
#AdditionalJar: firebase-ui-database.aar
#AdditionalJar: firebase-ui-firestore.aar
#AdditionalJar: firebase-ui-storage.aar

But as of now i did not find a solution to get the new UI-Auth running. I dont know why the classes are not recognized to be available. :mad:

Does anyone have an idea what this can be? Any hints are highly welcome :)
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Dooooh!
It does work! :)

Thank you very much. Sometime i do not see the forest about the trees.

Ok, i´m now facing a new problem. But it seems to be related to the manifest entries needed for the Update UI Bindings.

I´m a step further :)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
But it seems to be related to the manifest entries needed for the Update UI Bindings.
Fixed :D
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
FBAuth_SignedIn
SignedIn: Manfred Ssykor
FBAuth_SignedIn
SignedIn: Manfred Ssykor
FBAuth_TokenAvailable(true,xxxZQ)FBToken = xxxZQ
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Let me try something...
the error i got was to a missing manifest entry which i neeeded to add.
AddApplicationText( <activity
android:name="com.firebase.ui.auth.KickoffActivity"
android:label=""
android:exported="false"
android:theme="@style/FirebaseUI.Transparent" />

<activity
android:name="com.firebase.ui.auth.ui.email.RecoverPasswordActivity"
android:label="@string/fui_title_recover_password_activity"
android:exported="false" />

<activity
android:name="com.firebase.ui.auth.ui.email.RegisterEmailActivity"
android:label="@string/fui_sign_in_default"
android:exported="false" />

<activity
android:name="com.firebase.ui.auth.ui.phone.PhoneVerificationActivity"
android:label="@string/fui_sign_in_with_phone_number"
android:windowSoftInputMode="stateAlwaysVisible"
android:exported="false" />

<activity
android:name="com.firebase.ui.auth.ui.accountlink.WelcomeBackIdpPrompt"
android:label="@string/fui_title_welcome_back_idp_prompt"
android:exported="false" />

<activity
android:name="com.firebase.ui.auth.ui.accountlink.WelcomeBackPasswordPrompt"
android:label="@string/fui_title_welcome_back_password_prompt"
android:exported="false" />

<activity
android:name="com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity"
android:label="@string/fui_default_toolbar_title"
android:exported="false" />
<activity
android:name="com.firebase.ui.auth.ui.credentials.CredentialSaveActivity"
android:label=""
android:exported="false"
android:theme="@style/FirebaseUI.Transparent" />


)
CredentialSaveActivity was new and missing... After i added it it is working now.
 
Upvote 0
Top