简体   繁体   中英

Could not resolve all dependencies for configuration ':app:_debugApk'.Configuration with name 'default' not found

I have added the gradle files. Please review them and help me fix the problem. I am having a problem in gradle sync as I copied this project from github I followed every single step. Thanks

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

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.3'

            // NOTE: Do not place your application dependencies here; they  belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            jcenter()
        }
    }

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

    task copy_cardboard_images() {
        doFirst {
            exec {
                if (System.properties['os.name'].toLowerCase().contains('windows')) {
                    // windows
                    commandLine 'cmd', '/c', 'adb', 'pull', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
                } else {
                    // linux
                    commandLine 'adb', 'pull', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
                }
            }
        }
        doLast {
            copy {
                from 'CardboardCamera'
                into 'website/images'
            }
        }
    }

    task remove_cardboard_images() {
        doFirst {
            exec {
                if (System.properties['os.name'].toLowerCase().contains('windows')) {
                    // windows
                    commandLine 'cmd', '/c', 'adb', 'shell', 'rm',  '-r', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
                } else {
                    // linux
                    commandLine 'adb', 'shell', 'rm',  '-r', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
                }
            }
        }
    }

    task move_cardboard_images() {
        dependsOn copy_cardboard_images
        dependsOn remove_cardboard_images
    }



Build.gradle : app module 


apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.google.devrel.vrviewapp"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile project(':gvr-android-sdk/libraries:common')
    compile project(':gvr-android-sdk/libraries:commonwidget')
    compile project(':gvr-android-sdk/libraries:panowidget')
    compile project(':gvr-android-sdk/libraries:videowidget')
}


Settings.gradle : 

This code belongs to settings.gradle file

include ':app'
include ':app'
include ':gvr-android-sdk/libraries:audio'
include ':gvr-android-sdk/libraries:base'
include ':gvr-android-sdk/libraries:common'
include ':gvr-android-sdk/libraries:commonwidget'
include ':gvr-android-sdk/libraries:panowidget'
include ':gvr-android-sdk/libraries:videowidget'

Have you checked all the dependencies of your Android project, located in the Android folder? Inside there is the settings.gradle file. In this file every dependency of your project will be checked.

Example :

include 'your dependencies'

project(':your dependencies').projectDir = new File('path dependencies')

comment this lines with // :

    //Build.gradle : app module 

    //Settings.gradle : 

    //This code belongs to settings.gradle file

then try again

too ,this seem gradle class not declared and defined Properly .

Add this:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
       })
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile project(':gvr-android-sdk/libraries:common')
    compile project(':gvr-android-sdk/libraries:commonwidget')
    compile project(':gvr-android-sdk/libraries:panowidget')
    compile project(':gvr-android-sdk/libraries:videowidget')
   }

You can include an outside root project module using 'settings.gradle' file from your main project. It must to be a gradle project too and in the specific Android building situation, you must configure every module as an "android-library" plugin project.

For example, in 'MyApp' project settings.gradle you can try this:

include 'app'
include 'dagger'
project(':dagger').projectDir = new File('/Users/foo/workspace/stdlib/dagger')

Your 'MyApp' build.gradle must reflect the need of the 'dagger' module in a relative path Gradle way:

dependencies {
compile project(':dagger')
}

Steps :

  1. Close all cmd
  2. npm cache clean --force
  3. uninstall app from simulator or device

will save my day !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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