4
respostas

problema ao baixar o FloatingActionButton

Estou com um problema bem parecido ao do Igor Peixoto Cortez. Ao tentar baixar o "FloatingActionButton" recebo a mensagem abaixo. E se ignoro o problema e baixo mesmo assim, não consigo depois movimentar o botão via leyout. Somente via xml mas depois ele volta para o canto superior esquerdo.

" This operation requires the library androidx.recyclerview:recyclerview:+.

Problem: Inconsistencies in the existing project dependencies found. Version incompatibility between:

  • androidx.appcompat:appcompat:1.1.0@aar and:
  • androidx.appcompat:appcompat:1.1.0@aar

With the dependency:

  • androidx.annotation:*:1.1.0 versus:
  • androidx.annotation:*:2.0.0

The project may not compile after adding this library. Would you like to add it anyway? "

4 respostas

Tem como publicar o codigo do Gadle aqui?

Se ajudar, use as essas dependencias:

implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.0.0'

Segue o código "buid.gradle (Module: app)"

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "br.com.alura.agenda"
        minSdkVersion 19
        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(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    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.android.material:material:1.0.0'
}

Notei em comparativo com o meu Gradle que vc não tem a "Compile Opitions" setado no script. Tenta novamente com o gradle abaixo:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "br.com.alura.agenda"
        minSdkVersion 15
        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'
        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
}

dependencies {
    implementation 'com.google.android.material:material:1.0.0'

    implementation 'androidx.room:room-runtime:2.0.0'
    annotationProcessor 'androidx.room:room-compiler:2.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.0.0'
}

Mas vendo melhor, esse compile options provavelmente é pq eu usei o java 8. Ai seria melhor passar o projeto pelo GitHub para tentar rodar aqui.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software