我将我的android应用程序从eclipse迁移到Android。在这个“迁移”过程中,我决定将我的项目分成4个模块: GUI模块、引擎模块、共用模块和资源模块。
The problem is that I cannot include v4 or v7 libs... It does not recognize the import:"import android.support.v4."
以下是分级:
1.日内瓦级:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}1. GUI模块(主要模块)的分级:
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:support-v4:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile project(':audiorecengine')
compile 'com.google.android.gms:play-services:7.0.0'
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.audioRec"
minSdkVersion 10
targetSdkVersion 22
versionCode 73
versionName "4.0.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
lite {
applicationId = "com.audioRec"
versionCode 73
versionName "4.0.4"
}
pro {
applicationId = "com.audioRec.pro"
versionCode 13
versionName "3.0.3"
}
}
}发布于 2015-04-22 14:49:09
这个问题似乎是由GooglePlayService库引起的,它已经包含了v4支持库。解决方案是在编译playServices时排除支持-v4。
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':audiorecengine')
compile ('com.google.android.gms:play-services:7.0.0'){
exclude module: 'support-v4'
}
}另外,我从gradle依赖项中删除了v4,因为它已经包含在v7支持库中。
https://stackoverflow.com/questions/29797543
复制相似问题