-1

Can someone help me with this errors. First I had problems with design XML files, now this. I didn't come further than just creating a project to practice for my android studio version3.0.1. facing this problem so guyz help me out with full solution

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rahul.expensemanager"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == "com.android.support") {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "27.+"
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
//    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.2'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.firebaseui:firebase-ui-database:3.3.1'
    implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestCompile 'com.android.support:support-annotations:27.1.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
    implementation 'com.android.support:support-annotations:28.0.0-rc02'
    implementation 'com.android.support:design:28.0.0-rc02'        implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha1'
    implementation 'com.android.support:cardview-v7:28.0.0-rc02'
//    implementation "com.google.firebase:firebase-client-android:3.4.0"
}
apply plugin: 'com.google.gms.google-services'

enter image description here

Dadep
  • 2,796
  • 5
  • 27
  • 40

2 Answers2

0

I see in you implementations that you've mixed the support library versions. Do not do that. That'll lead to bugs. Always use one specific version for your support libraries. Mixing causes errors. Try this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rahul.expensemanager"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == "com.android.support") {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion "28.0.0-alpha1"
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
//    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.2'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.firebaseui:firebase-ui-database:3.3.1'
    implementation 'com.firebaseui:firebase-ui-firestore:3.3.1'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestCompile 'com.android.support:support-annotations:28.0.0-alpha1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
    implementation 'com.android.support:support-annotations:28.0.0-alpha1'
    implementation 'com.android.support:design:28.0.0-alpha1'        
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
//    implementation "com.google.firebase:firebase-client-android:3.4.0"
}
apply plugin: 'com.google.gms.google-services'

What I did was use the 28.0.0-alpha1 version of your for your project. Tell me if the error still exists.

Jacob Celestine
  • 1,758
  • 13
  • 23
  • what You mean sir please explaine – Rahul Ahmed Sep 11 '18 at 09:45
  • nd where from i can collect same versio of dependency – Rahul Ahmed Sep 11 '18 at 09:49
  • Basically what I meant was that for all `com.android.support` libraries, you should use the same version, like how I have used `28.0.0-alpha1`. Android studio will automatically tell you of there's a new version available. It's not always good to update, you'll face errors, like what happened now. Now tell me, did I solve your question? If yes, please accept this answer and close this question. – Jacob Celestine Sep 11 '18 at 12:19
0

It seems like the error come from sdk 28 .. i suggest you to change the sdk version in app level gradle file.

change your all dependencies into the sdk 27

 implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

to

   implementation 'com.android.support:appcompat-v7:27.1.1'

or

 implementation 'com.android.support:appcompat-v7:21.1.0'

like this change every dependencies where you find

 28.0.0-alpha1 

into these sdk version and then check , hope it will help you.

  and also change the sdk version to 28 to 27
harsh
  • 337
  • 1
  • 2
  • 14