Reputation: 51
This activity was originally working but then it suddenly stopped working and it showed me this error. I'm not sure how to fix it and I don't recall removing anything from my app.gradle files but does anyone know how to solve it? Any help would be greatly appreciated
Below is my passcode view main activity (XML shown below with error) ''' PasscodeView PasswordView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_password_view);
PasswordView = findViewById(R.id.PasswordView);
PasswordView.setPasscodeLength(4)
.setLocalPasscode("1234")
.setListener(new PasscodeView.PasscodeViewListener() {
@Override
public void onFail() {
Toast.makeText(PasswordView.this, "Passcode do not match",Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(String number) {
Intent intent = new Intent(PasswordView.this,Main2Activity.class);
startActivity(intent);
}
});
}}
'''
Screenshot of Error and XML for Password View
2nd Part of App.Gradle (Dependencies)
Upvotes: 5
Views: 6612
Reputation: 4227
in my case I replaced <Space
with <androidx.legacy.widget.Space
and error disappeared.
Upvotes: 0
Reputation: 8559
Instead of androidx.legacy.widget.Space
you can just use android.widget.Space
. Eg.:
<android.widget.Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:minHeight="1dp"/>
Upvotes: 5
Reputation: 1697
In your layout file, replace occurrences of androidx.legacy.widget.Space with View.
eg.
<androidx.legacy.widget.Space
android:layout_width="8dp"
android:layout_height="1dp" />
Should now be
<View
android:layout_width="8dp"
android:layout_height="1dp" />
Had the same issue after updating my Gradle Version.
Upvotes: 3
Reputation: 578
Add androidx.legacy:legacy-support-v4:1.0.0
in project dependencies section.
//app/build.gradle dependencies section
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Other dependencies
}
More Details : AndroidX Class Mappings,AndroidX Artifact Mappings
Upvotes: 9