This is my first post but I need some help,
This is my error :
error: package android.support.design.widget does not exist
import android.support.design.widget.FloatingActionButton;
This is my gradle codes
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.weatherviewerappeliasshahsamand"
minSdkVersion 23
targetSdkVersion 29
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
implementation 'com.google.android.material:material:1.2.0-alpha06'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
}
You have both support library and androidx library in your project...I think this must be issue.
You can use:
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
Instead of:
implementation 'com.android.support:appcompat-v7:28.0.0'
And you can replace your other support library codes and use androidx Library
You have migrated some of the dependencies to AndroidX but still some of the dependencies doesn't seems to match with android X .You will have to replace some of your dependencies to the latest version:
Replace
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
with
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
Now as the error message please replace the widgets to androidx or Migrate by
Refactor > Migrate to AndroidX > Migrate
Related
I'm a beginner developer in Android. I included
'com.android.support:appcompat-v7:28.0.0' and 'com.android.support:design:28.0.0' in build.gradle.
build.gradle:
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.financialapp"
minSdk 27
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
}
I want to use `'android.support.design.widget.CoordinatorLayout' in the XML file but then there is an error.
error:
error: package android.support.design.widget does not exist
import android.support.design.widget.CoordinatorLayout;
Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with
this: Refactor > Migrate to AndroidX.
Old:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
New:
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
Because you do not have dependency for material
inside your build.gradle(:app)
implementation 'com.google.android.material:material:1.4.0'
I've to migrate my old project to AndroidX and updating all dependencies to the newest version but the only one got an error in manifest merging.
only this dependency got Error ERROR: Manifest merger failed with multiple errors, see logs:
implementation 'com.google.android.libraries.places:places-compat:2.1.0'
I mean, when I remove it the error gone away.
this is my app.build
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.pertamina.tbbm.rewulu.ecodriving.mobil"
minSdkVersion 16
targetSdkVersion 28
versionCode 12
versionName "5.5.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
dexOptions {
javaMaxHeapSize "8g"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.libraries.places:places:2.1.0'
implementation 'com.google.android.libraries.places:places-compat:2.1.0'
implementation 'com.facebook.android:facebook-android-sdk:4.42.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
And here Manifest.xml
I really don't know whats any wrong with my configurations..looking online for a whole day but got nothing...
NB: When I migrate to AndroidX, pressing Refractor > Migrate to AndroidX there's is warning pop says No Usages Found in the Project.
Thanks
Try to remove implementation 'com.google.android.libraries.places:places:2.1.0' from your applications build.gradle file it should work fine
Have you tried replacing the dependency as below?
implementation "com.google.android.libraries.places:places:1.1.0"
When I integrate the Stripe library it creates linking resources
problems due to the SDK version. While when I upgrade my SDK version
from v7:27.1.1 to v7:28.0.0 and change my compile SDK version to 28
the problem is resolved then it causes the problem in the Manifest file.
add this library for the SDK version but not solve the problem.
build.gradle file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.1'
}}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.goldtech.linkbreed"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:3.0.0'
// for slider images
implementation 'com.github.smarteist:autoimageslider:1.3.2-appcompat'
implementation 'com.stripe:stripe-android:11.2.0' // stripe payment
implementation 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation 'com.github.shts:StoriesProgressView:3.0.0' // for stories
implementation 'com.allattentionhere:autoplayvideos:0.2.0' // for video in recyclerview
// indicator //
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.android.volley:volley:1.1.1'
////////////// exoplayer //////////////////////
implementation 'com.google.android.exoplayer:exoplayer:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-core:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-dash:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-hls:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-ui:r2.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
//implementation 'com.google.firebase:firebase-crash:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
This error occurs because of mismatched compileSdkVersion and library version.
Change the compileSdkVersion to 28.
android {
compileSdkVersion 28
...
}
I have the same problem as many other people with Gradle depencencies resolving...I already checked the other questions but it seems they handle different versions of each library wrt my case...so I decided to ask a new question. This is my app-level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "..."
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-login:5.1.1'
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.6'
//the line which causes the error
implementation 'com.firebase.firebaseui:firebase-ui-auth:4.3.1'
//these lines are added for handling appcompat error
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
and when I add the firebase-ui-auth line, the problem arises. How can I make it work? Furthermore, does someone know if there exists a web page where all the dependencies schemes are grouped? Thanks in advance.
To solve this, please change the following line of code:
implementation 'com.firebase.firebaseui:firebase-ui-auth:4.3.1'
to
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
But I recommend you use the latest version which is 5.0.0. Please see more details about Firebase-UI library.
Change this:
implementation 'com.firebase.firebaseui:firebase-ui-auth:4.3.1'
Into this:
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
The package is called com.firebaseui
I am making an Android app and I keep on getting the following warning. This warning is preventing me from connecting to Firebase on another PC when I clone the repo.
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
I have replaced all "compile" with implementation but still getting the warning. Below is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ak1195apps.employeelogs"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'joda-time:joda-time:2.10'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Upgrading to gradle 3.2.0 solved the problem.