android - ModuleVersionNotFoundException android 工作室

标签 android android-gradle-plugin

当我点击运行按钮时出现了这个错误

Error:org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:_debugApkCopy'.

Error:org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.support:appcompat-v7:27.0.1.

请看下面的截图

enter image description here

当我尝试 gradle 同步时 然后我遇到了这个问题

请看下面的截图

enter image description here

我的构建.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }

}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}
android {
    signingConfigs {
        config {
        }
    }
    repositories {
        mavenCentral()
    }
    compileSdkVersion 25
    buildToolsVersion '26.0.0'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.hechat"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    dexOptions {
        javaMaxHeapSize "2048M"
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'project.properties'
        exclude 'META-INF/INDEX.LIST'

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

    repositories {
        maven { url "https://dl.bintray.com/hani-momanii/maven" }
    }
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.google.code.findbugs'
    })
    compile('com.twitter.sdk.android:twitter:2.3.1@aar') { transitive = true; }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') { transitive = true; }
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:cardview-v7:25.0.0'
    compile 'com.android.support:design:25.0.0'
    compile 'net.gotev:uploadservice:2.1'
    compile 'com.android.support:recyclerview-v7:25.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
    compile 'com.google.android.gms:play-services:11.0.4'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.code.gson:gson:2.3'
    compile 'org.apache.httpcomponents:httpcore:4.3.2'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    compile 'com.github.clans:fab:1.6.2'
    compile 'org.jsoup:jsoup:1.8.1'
    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.splitwise:tokenautocomplete:1.3.3'
    compile 'com.tubb.smrv:swipemenu-recyclerview:5.2.1'
    compile 'com.github.bumptech.glide:glide:3.5.2'
    compile 'se.emilsjolander:stickylistheaders:2.7.0'
    compile 'com.mindorks:placeholderview:0.6.4'
    compile 'org.twitter4j:twitter4j-core:4.0.2'
    compile 'jp.wasabeef:fresco-processors:2.1.0'
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.android.billingclient:billing:1.0'

    testCompile 'junit:junit:4.12'
    compile project(':cometchat_platinum-sdk')

}


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

我没有使用过 v-27 那么为什么我面临 v7 问题 提前致谢

最佳答案

在您的应用级构建文件中添加 allprojects block

1.

 allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }}}

2。 使用 Android Studio 3.0 及更高版本创建的新项目还包括

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

并将您的 compileSdkVersion 更改为 26,并将 buildToolsVersion 更改为“26.0.1”,然后同步您的项目

希望对您有所帮助。

关于android - ModuleVersionNotFoundException android 工作室,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47688955/

相关文章:

android - SQLiteFullException : database or disk is full (code 13) GreenDao

android - 使用 Parcelable 通过 Intent 传递 ArrayList 时出现 NullPointerException

android - 外部 AndroidManifest.xml 未出现在项目 View Pane 下

android - 使用 gradle 包含 butterknife 时重复文件

android - getActionBar() 返回 null 并且 requestFeature() 出现在 ActionBarActivity 类中

android - 使用 volley android 下载 Zip 文件

java - 在 styles.xml 文件中为所有按钮声明一个通用的 onClick 属性

gradle - 如何禁用外部依赖 jar 的 Proguard 设置?

android - 如何在 gradle 中为 Android Asset Pack(不是 Android apk 模块)设置自定义 Assets 位置?

android - 从Play商店下载时无法加载应用程序,但可以安装生成的APK