Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.layout" on path: DexPathList[[zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/base.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_dependencies_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_resources_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_0_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_1_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_2_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_3_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_4_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_5_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_6_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_7_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_8_apk.apk", zip file "/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/mzz.work.login_signup-MmKrHS_eKGNcUeNOjZ3Bqg==/lib/arm64, /system/lib64]]
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 android.view.LayoutInflater.createView(LayoutInflater.java:606)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:723)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:740)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:808)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:844)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
2020-01-21 21:39:19.510 18902-18902/? E/AndroidRuntime: at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at android.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at mzz.work.login_signup.MainActivity.onCreate(MainActivity.java:31)
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import mzz.work.login_signup.databinding.ActivityMainBinding;
import mzz.work.login_signup.login.LoginFragment;
import mzz.work.login_signup.login.SignUpFragment;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static mzz.work.login_signup.FlexibleFrameLayout.ORDER_LOGIN_STATE;
import static mzz.work.login_signup.FlexibleFrameLayout.ORDER_SIGN_UP_STATE;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private ActivityMainBinding binding;
private boolean isLogin = true;
Context ctx = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
LoginFragment topLoginFragment = new LoginFragment();
SignUpFragment topSignUpFragment = new SignUpFragment();
getSupportFragmentManager().beginTransaction()
.replace(R.id.login_fragment, topLoginFragment)
.replace(R.id.sign_up_fragment, topSignUpFragment)
.commit();
binding.loginFragment.setRotation(-90);
binding.button.setOnSignUpListener(topSignUpFragment);
binding.button.setOnLoginListener(topLoginFragment);
binding.button.setOnButtonSwitched(new OnButtonSwitchedListener() {
@Override
public void onButtonSwitched(boolean isLogin) {
binding.getRoot()
.setBackgroundColor(ContextCompat.getColor(
ctx,
isLogin ? R.color.colorPrimary : R.color.secondPage));
}
});
binding.loginFragment.setVisibility(INVISIBLE);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
binding.loginFragment.setPivotX(binding.loginFragment.getWidth() / 2);
binding.loginFragment.setPivotY(binding.loginFragment.getHeight());
binding.signUpFragment.setPivotX(binding.signUpFragment.getWidth() / 2);
binding.signUpFragment.setPivotY(binding.signUpFragment.getHeight());
}
public void switchFragment(View v) {
if (isLogin) {
binding.loginFragment.setVisibility(VISIBLE);
binding.loginFragment.animate().rotation(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
binding.signUpFragment.setVisibility(INVISIBLE);
binding.signUpFragment.setRotation(90);
binding.wrapper.setDrawOrder(ORDER_LOGIN_STATE);
}
});
} else {
binding.signUpFragment.setVisibility(VISIBLE);
binding.signUpFragment.animate().rotation(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
binding.loginFragment.setVisibility(INVISIBLE);
binding.loginFragment.setRotation(-90);
binding.wrapper.setDrawOrder(ORDER_SIGN_UP_STATE);
}
});
}
isLogin = !isLogin;
binding.button.startAnimation();
}
}
Data binding might not be initialized in your app level build.gradle file. Please add dataBinding.enabled true in that file.
android {
compileSdkVersion 29
dataBinding.enabled true
.........
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With