Including android design library to the dependencies causes app to crash.
Im launching this on Nexus S emulator with 25 API. All my libraries are of the same version, so I don't know what's the problem.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0' //this one
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4: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'
implementation 'com.android.support:cardview-v7:28.0.0' // For CardView
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
Migrate your code to AndroidX, the new SDK dependency dir structure will help you avoid such problems now and in the future.
Related
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-storage:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Android support libraries are now replaced by androidX. I recommend you use this new approach if you are starting a new project or migrate if you are on a previous project as support libraries are now deprecated and no longer maintained. AndroidX
I'm sorry if I'm missing something obvious here, but I migrated my project to android X and still cannot use TabLayout in my layout files.
My dependencies in build.grade (app level):
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.airbnb.android:lottie:3.3.1'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
I also tried to add:
implementation 'com.android.support:design:27.1.0'
And then Android studio marks it as error and tells me to upgrade to Android X (which I did already)
If it matters, my compile sdk version is 29
build tools: 29.0.2
Thanks in advance
use implementation 'com.google.android.material:material:1.0.0'. It includes Tablayout
I have this code on my gradle file but I have an error which says
"mixing versions can lead to runtime crashes"
I made this project using the assistant of android studio
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
}
Try updating your 'com.google.firebase:firebase-core:16.0.1' to '16.0.6'. It's the most up-to-date version.
I am using FirebaseUI to try out the RecyclerViewAdapter. When I try to run the app the gradle build doesn't succeed and gives these errors:
Errors shown by Gradle
This doesn't happen when I take out the FirebaseUI Dependency.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'}
Edit: I added MultiDex Support as mentioned on Android Developers Site
What should I do to make the build successful and run the app.
Thanks in advance.
I am trying to integrate admob ad in my app but I am getting some red line under one of my dependencies code.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'**
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
while adding
implementation 'com.google.android.gms:play-services-ads:15.0.0'
I am getting red line under
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Where am I going wrong?
Try to downgrade the appcombat version to:
implementation 'com.android.support:appcompat-v7:27.1.1'
See more here.