使用单独的App作为依赖项时,程序包不存在

Use*_*231 8 java android gradle android-studio

我正在尝试使用单独的应用程序作为依赖项编译应用程序但是当我从这个库编译引用模块时,我看到几个"错误:包不存在"和"错误:无法找到来自graddle的符号类"消息.以下是我的两个构建文件.

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 19
    }

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

    packagingOptions {
        exclude 'AndroidManifest.xml'
        exclude 'resources.arsc'
        exclude 'classes.dex'
    }
}

dependencies {
    repositories {
        mavenCentral()
    }
    compile 'com.android.support:support-v4:+'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'com.android.support:support-v4:+'
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
    compile 'se.emilsjolander:stickylistheaders:2.+'
    compile 'com.googlecode.libphonenumber:libphonenumber:+'
    compile files('libs/crashlytics.jar')
    compile files('libs/httpclient-4.2.3.jar')
    compile files('libs/libphonenumber-5.9.jar')
    compile files('libs/mobileservices-0.2.0-javadoc.jar')
    compile files('libs/mobileservices-0.2.0.jar')
    compile files('libs/stringtotime-1.0.4.jar')
    compile files('libs/urbanairship-lib-2.0.2.jar')
    compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:+'
    compile files('libs/FlurryAnalytics-4.0.0.jar')
    compile 'com.squareup.picasso:picasso:2.3.3'
    compile project(':wheel')
}
Run Code Online (Sandbox Code Playgroud)

依赖性gradle:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "kankan.wheel"
        minSdkVersion 5
        targetSdkVersion 7
    }

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

}
Run Code Online (Sandbox Code Playgroud)

以前有人可以帮忙/经历过吗?Android Studio没有突出显示该类中的任何问题,我可以按住Ctrl键并单击所引用的包,这似乎意味着它已正确设置...

谢谢!

Vla*_*kin 6

buildTypes部分不应位于库build.gradle文件中.


Dog*_*oge 5

您不能同时使用该com.android.application插件使用两个gradle脚本.更改依赖项目以应用'library'插件.

如果不这样做,请将依赖项的targetSdkVersion更改为核心项目的targetSdkVersion.