Reputation: 834
Android Studio does not import some widget.
I have tried the following options and all have failed.
1.Invalidate cache and Restart
2.Clean and Rebuild Project
3.Exit AS,delete .iml file and .deal folder,import the project
4.Sync with File Sytem
5.Sync Project with Gradle files.
6.Uninstall AS and reinstall with the same version.
Non of the above have helped,Kindly could someone assist me.
App gradle level
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.viewvideo"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-firestore:21.3.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'androidx.multidex:multidex:2.0.0'
}
Project Gradle level
buildscript{
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 2
Views: 675
Reputation: 2319
I think, You are having problem with Android SDK. Remove and reinstall Android SDK will solve the issue
First try to manually import ImageButton inside your ViewActivity for checking class inside the library is available or not
import android.widget.ImageButton;
then Add
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
and remove
buildToolsVersion "29.0.2"
Sync and try again... let me know
Upvotes: 1