构建android studio模块无法找到包作为依赖项

时间:2015-08-19 19:34:42

标签: android android-studio gradle

我已经从eclipse向android工作室导入了一个模块,当我想从这个模块导入一个类时,构建失败并显示以下错误消息:

/home/matias/workspace/Apps/app/src/main/java/io/example/app/MainActivity.java:8: error: package com.example.components.activities does not exist
import com.example.components.activities.AndroidVideoCapture;
                                           ^
1 error

FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

模块components成功构建(使用'Build> Make Module'组件'),当我尝试构建应用程序时出现问题(同样,'Build> Make Module'应用程序')。

这是app build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "io.example.app"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile project(":components")
}

和组件build.gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-components.txt'
        }
    }
    aaptOptions {
        cruncherEnabled true
    }
}

dependencies {
    compile files('libs/amazon-ads-5.1.153.jar')
    compile files('libs/amazon-device-messaging-1.0.1.jar')
    compile project(':librarylvl')
    compile project(':crop_lib')
    compile project(':openGLVideoRenderer')
    compile project(':libffmpeg')

    //compile 'com.android.support:appcompat-v7:22.+'
    compile 'com.google.android.gms:play-services:+'

    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.github.bumptech.glide:volley-integration:1.3.0'
    compile 'com.mcxiaoke.volley:library:1.0.18'

    compile 'com.getbase:floatingactionbutton:1.10.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'

    compile 'com.android.support:cardview-v7:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'

    compile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    // change this 2 lines for release code
    //compile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
    //compile project(':nop-leakcanary')
}

所以.. 这里发生了什么?我缺少一些配置或步骤?

注意:如果我导入com.example.components.activities.* gradle无法找到包,但我可以从com.example.openglvideorenderer.RenderView模块中轻松导入openGLVideoRenderer

0 个答案:

没有答案