使用单独的 App 作为依赖项时,包不存在 [英] Package does not exist when using separate App as a dependency

查看:34
本文介绍了使用单独的 App 作为依赖项时,包不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to compile an App utilising a separate App as a dependency but when I compile referencing modules from this library I see several "error:package does not exist" and "error:cannot find symbol class" messages from graddle. The following are my two build files.

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')
}

依赖梯度:

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'
        }
    }

}

任何人都可以帮助/体验过这个吗?Android Studio 没有突出显示课程中的任何问题,我可以按 ctrl+click 到引用的包,这似乎意味着它已正确设置...

Can anyone help/experienced this before? Android Studio does not highlight any issues in the class and I can ctrl+click through to the packages referenced which seems to mean it is set up correctly...

谢谢!

推荐答案

您不能有两个同时使用 com.android.application 插件的 gradle 脚本.更改依赖项目以应用库"插件.

You cannot have two gradle scripts using the com.android.application plugin at the same time. Change the dependency project to apply the 'library' plugin.

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

If that doesn't do it, change the targetSdkVersion of your dependency to that of your core project.

这篇关于使用单独的 App 作为依赖项时,包不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆