找不到参数的方法compile()[com.android.support:design:25.1.0]

时间:2017-01-27 14:34:42

标签: java android intellij-idea gradle

在我对项目结构进行一些修改之前,我的代码正在运行。我试图恢复,但我仍然得到错误。

我最近升级了我的Android支持存储库,它在升级后运行。我的Android支持存储库是版本41。

Error Log:
2017-01-27 11:03:03,550 [  74030]   WARN - nal.AbstractExternalSystemTask - Could not find method compile() for arguments [com.android.support:design:25.1.0] on DefaultExternalModuleDependency{group='com.android.support', name='appcompat-v7', version='25.1.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.

*Please install the Android Support Repository from the Android SDK Manager. 
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not find method compile() for arguments [com.android.support:design:25.1.0] on DefaultExternalModuleDependency{group='com.android.support', name='appcompat-v7', version='25.1.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.
Please install the Android Support Repository from the Android SDK Manager.
    at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.createUserFriendlyError(ProjectImportErrorHandler.java:288)
    at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:153)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:401)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:772)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:752)
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:238)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:112)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:73)
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
    at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
    at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
    at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
    at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:138)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:124)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:419)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$2.run(ExternalSystemUtil.java:500)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)*

这是我的gradle.build文件:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
    /*signingConfigs {
    }*/
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.yomiolatunji.personallibrary"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            jniDebuggable false
            renderscriptDebuggable false
            minifyEnabled false
        }
    }
    dataBinding.enabled = true
}
ext {
    supportLibraryVersion = '25.1.0'
    okHttpVersion = '3.4.2'
    okHttp3DownloaderVersion = '1.1.0'
    picassoVersion = '2.5.2'
    junitVersion = '4.12'
    espressoVersion = '2.2.2'
    playServicesVersion = '10.0.1'
    firebaseVersion = '10.0.1'
    firebaseUiVersion = '1.1.1'
    barcodeScannerVersion = '1.9'
    icicleVersion = '1.0.0'
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //support library
    compile "com.android.support:appcompat-v7:$supportLibraryVersion" compile "com.android.support:design:$supportLibraryVersion" compile "com.android.support:support-v4:$supportLibraryVersion" compile "com.android.support:recyclerview-v7:$supportLibraryVersion" compile "com.squareup.okhttp3:okhttp-urlconnection:$okHttpVersion" compile "com.squareup.okhttp3:okhttp:$okHttpVersion" compile "com.squareup.picasso:picasso:$picassoVersion" compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:$okHttp3DownloaderVersion"
    //firebase
    compile "com.google.firebase:firebase-core:$firebaseVersion" compile "com.google.firebase:firebase-auth:$firebaseVersion" compile "com.google.firebase:firebase-database:$firebaseVersion" compile "com.google.firebase:firebase-crash:$firebaseVersion"
    //firebase ui
    compile "com.firebaseui:firebase-ui-auth:$firebaseUiVersion" compile "com.firebaseui:firebase-ui-database:$firebaseUiVersion" compile "com.google.android.gms:play-services-vision:$playServicesVersion" compile "me.dm7.barcodescanner:zbar:$barcodeScannerVersion" compile "com.segunfamisa:icicle:$icicleVersion" apt "com.segunfamisa:icicle-processor:$icicleVersion" testCompile "junit:junit:$junitVersion" androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
}

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

1 个答案:

答案 0 :(得分:7)

您在构建文件中丢失了一些换行符。

以下内容:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //support library
    compile "com.android.support:appcompat-v7:$supportLibraryVersion" compile "com.android.support:design:$supportLibraryVersion" compile "com.android.support:support-v4:$supportLibraryVersion" compile "com.android.support:recyclerview-v7:$supportLibraryVersion" compile "com.squareup.okhttp3:okhttp-urlconnection:$okHttpVersion" compile "com.squareup.okhttp3:okhttp:$okHttpVersion" compile "com.squareup.picasso:picasso:$picassoVersion" compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:$okHttp3DownloaderVersion"
    //firebase
    compile "com.google.firebase:firebase-core:$firebaseVersion" compile "com.google.firebase:firebase-auth:$firebaseVersion" compile "com.google.firebase:firebase-database:$firebaseVersion" compile "com.google.firebase:firebase-crash:$firebaseVersion"
    //firebase ui
    compile "com.firebaseui:firebase-ui-auth:$firebaseUiVersion" compile "com.firebaseui:firebase-ui-database:$firebaseUiVersion" compile "com.google.android.gms:play-services-vision:$playServicesVersion" compile "me.dm7.barcodescanner:zbar:$barcodeScannerVersion" compile "com.segunfamisa:icicle:$icicleVersion" apt "com.segunfamisa:icicle-processor:$icicleVersion" testCompile "junit:junit:$junitVersion" androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
}

应该是:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //support library
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.android.support:design:$supportLibraryVersion"
    compile "com.android.support:support-v4:$supportLibraryVersion"
    compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
    compile "com.squareup.okhttp3:okhttp-urlconnection:$okHttpVersion"
    compile "com.squareup.okhttp3:okhttp:$okHttpVersion"
    compile "com.squareup.picasso:picasso:$picassoVersion"
    compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:$okHttp3DownloaderVersion"
    //firebase
    compile "com.google.firebase:firebase-core:$firebaseVersion"
    compile "com.google.firebase:firebase-auth:$firebaseVersion"
    compile "com.google.firebase:firebase-database:$firebaseVersion"
    compile "com.google.firebase:firebase-crash:$firebaseVersion"
    //firebase ui
    compile "com.firebaseui:firebase-ui-auth:$firebaseUiVersion"
    compile "com.firebaseui:firebase-ui-database:$firebaseUiVersion"
    compile "com.google.android.gms:play-services-vision:$playServicesVersion"
    compile "me.dm7.barcodescanner:zbar:$barcodeScannerVersion"
    compile "com.segunfamisa:icicle:$icicleVersion"
    apt "com.segunfamisa:icicle-processor:$icicleVersion"
    testCompile "junit:junit:$junitVersion"
    androidTestCompile("com.android.support.test.espresso:espresso-core:$espressoVersion", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
}