我在Android Studio 3.0中遇到问题。我正在使用Windows 7-64位。

android - 无法解决:com.android-LMLPHP

每当我想在手机上启动我的应用程序时,它就会崩溃。因此,当我用Google搜索它时,我发现可能存在版本不匹配的情况,因此我对build.gradle文件进行了一些更改。进行更改并进行一些调试后,我无法解决此错误。


  错误:无法解决:com.android


以下是我的MyProject/app/build.gradle文件:

apply plugin: 'com.android.application'

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

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.planner.reemshams.projectplannerpro"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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'
})
    compile 'com.android.support:appcompat-v7-26+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7-24+'
    compile 'com.android.support:cardview-v7-26+'
    testCompile 'junit:junit:4.12'
    implementation 'com.android.support:design-v7-26+'
}


编辑:尝试构建/运行应用程序时,在Messages选项卡上获得了以下内容。

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.android.support:appcompat-v7-26+:.
  Searched in the following locations:
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
      https://jcenter.bintray.com/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      https://jcenter.bintray.com/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
      https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.pom
      https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7-26+//appcompat-v7-26+-.jar
  Required by:
      project :app
> Could not find com.android.support:recyclerview-v7-24+:.
  Searched in the following locations:
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
      https://jcenter.bintray.com/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      https://jcenter.bintray.com/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
      https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.pom
      https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7-24+//recyclerview-v7-24+-.jar
  Required by:
      project :app
> Could not find com.android.support:cardview-v7-26+:.
  Searched in the following locations:
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
      https://jcenter.bintray.com/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      https://jcenter.bintray.com/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
      https://dl.google.com/dl/android/maven2/com/android/support/cardview-v7-26+//cardview-v7-26+-.pom
      https://dl.google.com/dl/android/maven2/com/android/support/cardview-v7-26+//cardview-v7-26+-.jar
  Required by:
      project :app
> Could not find com.android.support:design-v7-26+:.
  Searched in the following locations:
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/design-v7-26+//design-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/m2repository/com/android/support/design-v7-26+//design-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/design-v7-26+//design-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/design-v7-26+//design-v7-26+-.jar
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/design-v7-26+//design-v7-26+-.pom
      file:/C:/Users/WinDows7/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/design-v7-26+//design-v7-26+-.jar
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design-v7-26+//design-v7-26+-.pom
      file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/support/design-v7-26+//design-v7-26+-.jar
      https://jcenter.bintray.com/com/android/support/design-v7-26+//design-v7-26+-.pom
      https://jcenter.bintray.com/com/android/support/design-v7-26+//design-v7-26+-.jar
      https://dl.google.com/dl/android/maven2/com/android/support/design-v7-26+//design-v7-26+-.pom
      https://dl.google.com/dl/android/maven2/com/android/support/design-v7-26+//design-v7-26+-.jar
  Required by:
      project :app

最佳答案

您不应使用以26+或24+结尾的库。您应该指定您的版本。试试这个代码,它可以正常工作(我已经测试过)

apply plugin: 'com.android.application'


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

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.planner.reemshams.projectplannerpro"
        minSdkVersion 17
        targetSdkVersion 26
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
}

08-15 20:17