繁体   English   中英

Android Studio:需要更改版本号,但如果执行失败则无法解决

[英]Android Studio: need to change Version number, but failed to resolve if I do

我是Android Studio的新手,在搜索该网站上的问题解决方案后,我似乎遇到了一个全新的问题。

我尝试同步Grandle文件时遇到的主要问题通常是“请更新版本至(版本号)”

我这样做了,但是到这一点,我将收到一个或多个错误,提示“无法解决:[应用名称和版本]”

此时我该怎么办? 考虑到我基于此发现的所有其他信息都应该修复它,现在似乎没有任何意义。

我的代码如下

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "twitchy.groupchatapp"
        minSdkVersion 25
        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.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:23.4.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.firebaseui:firebase-ui:0.6.0'
    implementation 'com.google.firebase:firebase-auth:9.2.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}


apply plugin: 'com.google.gms.google-services'

非常感谢您的协助*注意:该代码是在我将每个代码更改为具有相同的版本号之前的代码这是我在执行此操作时收到的错误

Failed to resolve: com.android.support.constraint:constraint-layout:11.4.2
Show in File
Show in Project Structure dialog


Failed to resolve: com.android.support:design:11.4.2
Show in File
Show in Project Structure dialog


Failed to resolve: com.firebaseui:firebase-ui:11.4.2
Show in File
Show in Project Structure dialog

现在添加了构建级别Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

com.android.support:项目和FirebaseUI都不具有版本11.4.2依赖性。

这些必须与文件顶部的compileSdk版本匹配。

对于您的用例,

implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support:design:27.+'

然后,ConstraintLayout, 查看文档

这行是正确的,并且与您的错误不符。

implementation 'com.android.support.constraint:constraint-layout:1.0.2'

该11.4.2编号仅适用于Google Play服务,并且仅适用于Firebase ,如果您要启动新的应用程序,则应相应更新。

例如,

implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'

Firebase UI版本必须与此兼容

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM